Log4netConfiguration.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>
  <log4net>
    <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
        <file type="log4net.Util.PatternString" value="%property{DirectoryBase}\\%date{yyyy-MM}\\.log" />
         
        <appendToFile value="true" />
        <PreserveLogFileNameExtension value="true" />
        <rollingStyle value="Date" />
        <!-- <staticLogFileName value="true" /> -->
        <staticLogFileName value="false" />
        <datePattern value="yyyy-MM-dd" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%date{yyyy-MM-dd HH:mm:ss.fffzzz}|%-5level|%logger|%property{NDC}|%message%newline" />
        </layout>
    </appender>
    <appender name="FileAppender-biz.dfch.PS.System.Logging" type="log4net.Appender.FileAppender">
        <file type="log4net.Util.PatternString" value="%property{DirectoryBase}\\%date{yyyy-MM}\\%date{yyyy-MM-dd}.log" />
        <appendToFile value="true" />
        <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%date{yyyy-MM-dd HH:mm:ss.fffzzz}|%message%newline" />
        </layout>
    </appender>
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date{yyyy-MM-dd HH:mm:ss.fffzzz}|%message%newline" />
      </layout>
    </appender>
    <appender name="GelfUdpAppender" type="gelf4net.Appender.GelfUdpAppender, gelf4net">
      <remoteAddress value="192.168.60.130"/>
      <remotePort value="12201" />
      <layout type="Gelf4net.Layout.GelfLayout, Gelf4net">
        <param name="AdditionalFields" value="app:RandomSentence,version:1.0,Level:%level" />
        <param name="Facility" value="RandomPhrases" />
        <param name="IncludeLocationInformation" value="true"/>
        <!-- Sets the full_message and short_message to the specified pattern-->
        <!--<param name="ConversionPattern" value="[%t] %c{1} - %m" />-->
      </layout>
    </appender>
    <appender name="GelfUdpHostNameAppender" type="gelf4net.Appender.GelfUdpAppender, gelf4net">
      <remoteHostName value="my.graylog2.local"/>
      <remotePort value="12201" />
      <layout type="Gelf4net.Layout.GelfLayout, Gelf4net">
        <param name="AdditionalFields" value="app:RandomSentence,version:1.0,Level:%level" />
        <param name="Facility" value="RandomPhrases" />
        <param name="IncludeLocationInformation" value="true"/>
        <!-- Sets the full_message and short_message to the specified pattern-->
        <!--<param name="ConversionPattern" value="[%t] %c{1} - %m" />-->
      </layout>
    </appender>
    <appender name="GelfAmqpAppender" type="gelf4net.Appender.GelfAmqpAppender, gelf4net">
      <remoteAddress value="192.168.60.130" />
      <remotePort value="5672" />
      <username value="guest" />
      <password value="guest" />
      <virtualHost value="/" />
      <exchange value="sendExchange" />
      <key value="key" />
      <layout type="Gelf4net.Layout.GelfLayout, Gelf4net">
        <param name="AdditionalFields" value="app:RandomSentence,version:1.0,Level:%level" />
        <param name="Facility" value="RandomPhrases" />
        <param name="IncludeLocationInformation" value="true"/>
        <!-- Sets the full_message and short_message to the specified pattern-->
        <!--<param name="ConversionPattern" value="[%t] %c{1} - %m" />-->
      </layout>
    </appender>
 
    <logger name="biz.dfch.PS.System.Logging" additivity="False">
        <level value="ALL" />
        <appender-ref ref="FileAppender-biz.dfch.PS.System.Logging" />
    </logger>
    <logger name="Esacalated" additivity="False">
        <level value="ERROR" />
        <appender-ref ref="ConsoleAppender" />
        <!-- <appender-ref ref="EventLogAppender" /> -->
    </logger>
  </log4net>
</configuration>