lundi 6 juin 2016

Log4net not writing logs to specified path

I am working with log for net i have below LOg4Net.config file code.But It is not writing logs to defined path .Am i doing anything wrong.Shall i miss anything??

Config:

-->

<appender name="ErrorRollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
  <file value="C:\Temp\Logs\FileTransferService\Error.txt" />
  <appendToFile value="true" />
  <rollingStyle value="Size" />
  <maxSizeRollBackups value="10" />
  <maximumFileSize value="2MB" />
  <staticLogFileName value="true" />
  <!--<threshold value="ERROR" />-->
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%message%newline" />
  </layout>
  <filter type="log4net.Filter.LevelRangeFilter">
    <levelMin value="ERROR"></levelMin>
    <levelMax value="FATAL"></levelMax>
  </filter>
</appender>

<root>
  <level value="ALL" />
  <appender-ref ref="InfoRollingLogFileAppender" />
  <appender-ref ref="ErrorRollingLogFileAppender" />
  <appender-ref ref="trace" />
</root>

<!--<logger name="CustomLogger">
  <level value="ALL" />
  <appender-ref ref="InfoRollingLogFileAppender" />
  <appender-ref ref="ErrorRollingLogFileAppender" />
  <appender-ref ref="trace" />
</logger>-->

Assembly Info Code:

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)]

Output Directory :

Copy always

Aucun commentaire:

Enregistrer un commentaire