Hi all,
I’m fine tuning the logging but it’s not quite right…
What I want is for the file to roll at midnight to a new date pattern file and roll within the same day if it reaches 50MB.
Eg.
Start up application, 21-NOV-2008, file gets created
myComp.Job Scheduler Service.20081121.log.txt
ideally, service continues to run, midnight rolls around and there’s a new file created for the 22nd and entries go to that.
myComp.Job Scheduler Service.20081122.log.txt
Problem is I’m not getting that… I’m getting a roll of the current file suffixed with the starting date? And logging continues to the same “21st” file pattern
myComp.Job Scheduler Service.20081121.log.txt ß latest entries in here
myComp.Job Scheduler Service.20081121.log.txt20081121 ß rolled file at midnight.
I’ve tried setting the rollingStyle to Date or Composite, but that hasn’t worked either.
This is possible??
Below is the config options. I’d appreciate any help.
Also, I may have misinterpreted the maxSizeRollBackups… I’ve assumed that would keep 10 days worth of log files and then start deleting older log files for me, but I’m beginning to think that only applies to the rolls with a day?
So I’ll have to clean up any log files OLDER than 10 days?
Thanks in advance.
Hadley
<!-- local messages-->
<appender name="LocalRollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString"
value="${ALLUSERSPROFILE}\Application Data\Job Scheduler\%env{COMPUTERNAME}.Job Scheduler Service.%date{yyyyMMdd}.log.txt" />
<!-- if an existing file is there, continue and append to it -->
<appendToFile value="true" />
<rollingStyle value="Composite" />
<!-- roll on a full date change, use yyyyMMdd-HH for hourly -->
<datePattern value="yyyyMMdd" />
<!-- keeps up to 10 of these files, for an entire DAY, IGNORE The size -->
<maxSizeRollBackups value="10" />
<!-- within a day, if the file size reaches 50MB, roll it too -->
<!-- because it's text, Log file service will zip this down to around 5MB -->
<!-- 5MB for mailing a log file is a safe size, most servers won't bounce that -->
<maximumFileSize value="50MB" />
<!-- layout, including our custom property, customAssemblyName-->
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5level %date %-50%type %-40%method %message%newline" />
</layout>
</appender>