Hi Nicko,
Does this issue arise each time you restart your service or just
sometimes when you restart?
Only sometimes.
Does this issue occur if you write to a local disk rather than a share?
I have not noticed it. I have not configured the service to do that.
What OS and file system is the logs share using?
Windows 2000 Server, NTFS.
Does the appender write the current logs into the incorrectly named
file? or does it also create the correctly named file?
It seems to happen when the correctly named file already exists, and in
every case that I see, there is output in that file. The app is
multi-threaded, and there is a timer event that wakes up the
job-dispatching thread, which checks the database and starts off a
thread to do whatever is scheduled in the database. The job-dispatcher
thread then dies.
I see two cases of this in the log directory right now. The first case
has output into the correctly named file up to a certain time. Then the
output goes into the second file for a few minutes, for the duration of
a certain scheduled chunk of work. Then it goes back into the correct
file. The log output doesn't reveal whether I restarted the service
twice to cause this situation.
In the second case I can see log statements indicating that I restarted
the service. When I started it again, the incorrectly named file
received all further output until midnight, when a new file was created.
If it's helpful, I can try stopping and restarting the service
repeatedly during a time when there will be nothing scheduled in the
database, and the only output would be "I got started!" so it wouldn't
negatively impact our systems. Maybe if I do this enough I can
reproduce the behavior. If so, I guess I should enable internal debugging?
Thanks!
Baron
-----Original Message-----
From: Baron Schwartz [mailto:[EMAIL PROTECTED]
Sent: 27 June 2005 20:01
To: [email protected]
Subject: Log files misnamed
I have a RollingFileAppender configured as follows:
<log4net>
<appender name="FileAppender"
type="log4net.Appender.RollingFileAppender">
<file value="//tank/logs$/seo/log-" />
<appendToFile value="true" />
<datePattern value="yyyy-MM-dd'.txt'" />
<rollingStyle value="Date" />
<staticLogFileName value="false" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5p %d %c line
%L%n %m%n" />
</layout>
</appender>
<appender name="SmtpAppender"
type="log4net.Appender.SmtpAppender">
<to value="[edit]" />
<from value="[edit]" />
<subject value="SEO error" />
<smtpHost value="madrid" />
<bufferSize value="2" />
<lossy value="true" />
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="WARN"/>
</evaluator>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5p %d %c line
%L%n %m%n" />
</layout>
</appender>
<root>
<level value="ERROR" />
<appender-ref ref="FileAppender" />
<appender-ref ref="SmtpAppender" />
</root>
<logger name="SeoLibrary">
<level value="INFO" />
</logger>
</log4net>
It should (and usually does) produce files named thusly:
log-2005-06-27.txt
But every now and again, when I restart the service that's
doing the logging, it makes a new file named incorrectly:
log-2005-06-27.txt2005-06-27.txt
What do you think? It's not a real problem for me, but maybe
it is a bug.
Thanks
Baron