Code Coverage by Clover.NET

Rolling logs

View: New views
1 Messages — Rating Filter:   Alert me  

Rolling logs

by Glenn E. Lanier, II :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have the following configuration file, and I want my "GeneralLog" to contain all log messages for a particular day, for all users. I want my "ErrorLog" to contain only Errors that occur on the current day, with archived logs in the archive folder called Error0001.log, etc.
 
My "GeneralLog" works as desired, but the error log will not update if the file exists from a previous day. If I delete it, it will start logging again.
 
Any ideas on what should be changed to make this work as desired?
 
<configuration>
 <configSections>
  <section name="nlog" type="NLog.Config.ConfigSectionhandler, NLog" />
 </configSections>
 
 <nlog autoReload="true">
  <targets>
   <target name="GeneralLog" type="File" filename="${basedir}/logs/${date:format=yyyy.MM.dd}-General.log" CreateDirs="true" layout="${longdate}|${level:uppercase=true}|${machinename}|${windows-identity:domain=false}|${logger}|${message}" />
   <target name="ErrorLog" type="File" filename="${basedir}/logs/Error.log" CreateDirs="true" layout="${longdate}|${machinename}|${windows-identity:domain=false}|${level:uppercase=true}|${message}|${callsite}" archiveFileName="${basedir}/logs/archive/Errors####.log" archiveNumbering="Sequence" archiveEvery="Day" maxArchiveFiles="7" />   
  </targets>
  
  <rules>   
   <logger name="*" levels="Info,Warn,Error,Debug,Fatal,Trace" writeTo="GeneralLog" />
   <logger name="*" levels="Error" writeTo="ErrorLog" />
  </rules>
 </nlog>
</configuration>
 
Thanks,
Glenn
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Nlog-list mailing list
Nlog-list@...
https://lists.sourceforge.net/lists/listinfo/nlog-list
LightInTheBox - Buy quality products at wholesale price