123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <?xml version="1.0" encoding="utf-8" ?>
- <configuration>
- <configSections>
- <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
- </configSections>
- <log4net>
- <!-- Agv日志文件-->
- <appender name="InfoFileAppender" type="log4net.Appender.RollingFileAppender">
- <!-- RollingFileAppender以FileAppender为基础 -->
- <File value="Log\InfoLog" />
- <!--<file value="${TMP}\LOGS\" /> tmp为环境变量里的路径值,未配置环境变量地址就生成在temp中,log-file.txt为文件名 -->
- <param name="AppendToFile" value="true" />
- <!-- 指定是追加到还是覆盖掉已有的日志文件 -->
- <!--<lockingModel type="log4net.Appender.FileAppender+InterProcessLock" />-->
- <param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
- <!-- 启用最小锁定格式以允许多个进程可以写入同一个文件-->
- <param name="RollingStyle" value="Composite" />
- <!--按照何种方式产生多个日志文件(指明文件名是变动的,日期[Date],文件大小[Size],混合[Composite])-->
- <StaticLogFileName value="false" />
- <DatePattern value="yyyy\\MM\\dd\\yyyy-MM-dd'.txt'" />
- <MaxSizeRollBackups value="-1" />
- <!-- 最多个数为-1无限个-->
- <MaximumFileSize value="2MB" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="时间:%date___描述:%message%newline" />
- </layout>
- </appender>
- <!-- 报警日志文件 -->
- <appender name="AlarmInfoFileAppender" type="log4net.Appender.RollingFileAppender">
- <!-- RollingFileAppender以FileAppender为基础 -->
- <File value="Log\AlarmInfo" />
- <!--<file value="${TMP}\LOGS\" /> tmp为环境变量里的路径值,未配置环境变量地址就生成在temp中,log-file.txt为文件名 -->
- <param name="AppendToFile" value="true" />
- <!-- 指定是追加到还是覆盖掉已有的日志文件 -->
- <!--<lockingModel type="log4net.Appender.FileAppender+InterProcessLock" />-->
- <param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
- <!-- 启用最小锁定格式以允许多个进程可以写入同一个文件-->
- <param name="RollingStyle" value="Composite" />
- <!--按照何种方式产生多个日志文件(指明文件名是变动的,日期[Date],文件大小[Size],混合[Composite])-->
- <StaticLogFileName value="false" />
- <DatePattern value="yyyy\\MM\\dd\\CSV_yyyy-MM-dd'.txt'" />
- <MaxSizeRollBackups value="-1" />
- <!-- 最多个数为-1无限个-->
- <MaximumFileSize value="2MB" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="时间:%date___描述:%message%newline" />
- </layout>
- </appender>
- <!-- 运行错误日志文件 -->
- <appender name="ErrFileAppender" type="log4net.Appender.RollingFileAppender">
- <!-- RollingFileAppender以FileAppender为基础 -->
- <File value="Log\ErrInfo" />
- <!--<file value="${TMP}\LOGS\" /> tmp为环境变量里的路径值,未配置环境变量地址就生成在temp中,log-file.txt为文件名 -->
- <param name="AppendToFile" value="true" />
- <!-- 指定是追加到还是覆盖掉已有的日志文件 -->
- <!--<lockingModel type="log4net.Appender.FileAppender+InterProcessLock" />-->
- <param name="lockingModel" type="log4net.Appender.FileAppender+MinimalLock" />
- <!-- 启用最小锁定格式以允许多个进程可以写入同一个文件-->
- <param name="RollingStyle" value="Composite" />
- <!--按照何种方式产生多个日志文件(指明文件名是变动的,日期[Date],文件大小[Size],混合[Composite])-->
- <StaticLogFileName value="false" />
- <DatePattern value="yyyy\\MM\\dd\\CSV_yyyy-MM-dd'.txt'" />
- <MaxSizeRollBackups value="-1" />
- <!-- 最多个数为-1无限个-->
- <MaximumFileSize value="2MB" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="时间:%date___描述:%message%newline" />
- </layout>
- </appender>
- <logger name="LogInfo">
- <level value="INFO" />
- <appender-ref ref="InfoFileAppender" />
- </logger>
- <logger name="AlarmLogInfo">
- <level value="WARN" />
- <appender-ref ref="AlarmInfoFileAppender" />
- </logger>
- <logger name="ErrLogInfo">
- <level value="ERROR" />
- <appender-ref ref="ErrFileAppender" />
- </logger>
- </log4net>
- </configuration>
- <!-- log4net-警告的信息级别区分 -->
- <!--<appender name="AspNetTraceAppender" type="log4net.Appender.AspNetTraceAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%n==========
- %n【日志级别】%-5level
- %n【记录时间】%date
- %n【线程ID】[%thread]
- %n【出错文件】%F
- %n【出错行号】%L
- %n【出错的类】%logger 属性:[%property{NDC}]
- %n【错误描述】%message
- %n【错误详情】%newline" />
- </layout>
- </appender>-->
- <!-- log4net-消息缓冲区配置(将日志信息进行缓存,达到10条时把日志输出,只有WARN及更高级别时才会被记录 ) -->
- <!--<appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender" >
- <bufferSize value="5"/>
- <lossy value="true" />
- <evaluator type="log4net.Core.LevelEvaluator">
- <threshold value="WARN"/>
- </evaluator>
- <appender-ref ref="ConsoleAppender" />
- </appender>-->
- <!--log4net-ERROR消息打印到控制台_红底白字-->
- <!--<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
- <mapping>
- <level value="ERROR" />
- <foreColor value="White" />
- <backColor value="Red, HighIntensity" />
- </mapping>
- <mapping>
- <level value="WARN" />
- <foreColor value="Yellow" />
- </mapping>
- <mapping>
- <level value="INFO" />
- <foreColor value="White" />
- </mapping>
- <mapping>
- <level value="DEBUG" />
- <backColor value="Green" />
- </mapping>
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%n==========
- %n【日志级别】%-5level
- %n【记录时间】%date
- %n【线程ID】[%thread]
- %n【出错文件】%F
- %n【出错行号】%L
- %n【出错的类】%logger 属性:[%property{NDC}]
- %n【错误描述】%message
- %n【错误详情】%newline" />
- </layout>
- </appender>-->
- <!-- log4net-将日志消息定向到控制台错误流 -->
- <!--<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
- <target value="Console.Error" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%n==========
- %n【日志级别】%-5level
- %n【记录时间】%date
- %n【线程ID】[%thread]
- %n【出错文件】%F
- %n【出错行号】%L
- %n【出错的类】%logger 属性:[%property{NDC}]
- %n【错误描述】%message
- %n【错误详情】%newline" />
- </layout>
- </appender>-->
- <!-- log4net-将日志写入本地机器的应用程序事件日志中 -->
- <!--<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
- <applicationName value="MyApp" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%n==========
- %n【日志级别】%-5level
- %n【记录时间】%date
- %n【线程ID】[%thread]
- %n【出错文件】%F
- %n【出错行号】%L
- %n【出错的类】%logger 属性:[%property{NDC}]
- %n【错误描述】%message
- %n【错误详情】%newline" />
- </layout>
- </appender>-->
- <!-- 向指定网络sink发送日志 -->
- <!--<appender name="RemotingAppender" type="log4net.Appender.RemotingAppender" >
- <sink value="tcp://localhost:8085/LoggingSink" />
- <lossy value="true" />
- <bufferSize value="95" />
- <onlyFixPartialEventData value="true" />
- <evaluator type="log4net.Core.LevelEvaluator">
- <threshold value="ERROR"/>
- </evaluator>
- </appender>-->
- <!-- 向指定邮箱发送日志 -->
- <!--<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender,log4net">
- <to value="***@qq.com" />
- <from value="840937370@qq.com" />
- <username value="840937370@qq.com" />
- -->
- <!--为客户端授权码-->
- <!--
- <password value="***********" />
- <subject value="B2P主控中心Error警告" />
- <smtpHost value="SMTPServer.qq.com" />
- <bufferSize value="512" />
- -->
- <!-- 大小超过512发送一次-->
- <!--
- <lossy value="true" />
- <evaluator type="log4net.Core.LevelEvaluator,log4net">
- <threshold value="WARN" />
- </evaluator>
- <layout type="log4net.Layout.PatternLayout,log4net">
- <conversionPattern value="
- %n【log4net的HostName】%property{log4net:HostName} ::
- %n【日志级别】%-5level
- %n【记录时间】%date
- %n【线程ID】[%thread]
- %n【出错文件】%F
- %n【出错行号】%L
- %n【出错的类】%logger 属性:%property{NDC}
- %n【错误描述】%message
- %newlineLogger: %logger%newlineThread: %thread%newlineDate: %date%newlineNDC:
- %n【错误详情】%newline%newline" />
- </layout>
- </appender>-->
- <!-- 使用SmtpPickupDir时的配置-->
- <!--<appender name="SmtpPickupDirAppender" type="log4net.Appender.SmtpPickupDirAppender">
- <to value="to@domain.com" />
- <from value="from@domain.com" />
- <subject value="test logging message" />
- <pickupDir value="C:\SmtpPickup" />
- <bufferSize value="512" />
- <lossy value="true" />
- <evaluator type="log4net.Core.LevelEvaluator">
- <threshold value="WARN"/>
- </evaluator>
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%n==========
- %n【日志级别】%-5level
- %n【记录时间】%date
- %n【线程ID】[%thread]
- %n【出错文件】%F
- %n【出错行号】%L
- %n【出错的类】%logger 属性:[%property{NDC}]
- %n【错误描述】%message
- %n【错误详情】%newline" />
- </layout>
- </appender>-->
|