Rolling logs

1 message Options
Embed this post
Permalink
Glenn E. Lanier, II

Rolling logs

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list