如题:
如果红字的不写,所有的logger都会继承root。所有的日志都会记录一个主要的日志文件里,现在加了红字的,红字部分的只记录到自己相对应的目录里
<log4net debug="false">
<!---不继承root的关系 additivity="false"-->
<logger name="CPUDefault" additivity="false">
<level value="All" />
<appender-ref ref="CPUDefaultappender" />
</logger>
<appender name="CPUDefaultappender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="CPULog\\" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<param name="AppendToFile" value="true" />
<param name="MaxSizeRollBackups" value="10" />
<param name="MaxFileSize" value="10240" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value="yyyy-MM-dd".txt"" />
<param name="RollingStyle" value="Date" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="[%date][%-5level]%m%n" />
</layout>
</appender>
<appender name="Default" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\\" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<param name="AppendToFile" value="true" />
<param name="MaxSizeRollBackups" value="10" />
<param name="MaxFileSize" value="10240" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value="yyyy-MM-dd".txt"" />
<param name="RollingStyle" value="Date" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="[%date][%-5level]%m%n" />
</layout>
</appender>