The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.
| Author |
Messages |
|
Moss, Barney
 |
| 11/15/2005 10:51 AM |
|
I use the RollingFileAppender to write a logfile from a long-lived process. It is configured with static logfile name and to roll by date:
<appender name="LogfileAppender" type="log4net.Appender.RollingFileAppender"> <file value="logs\\CAPS_DMS.log" /> <RollingStyle value="date" /> <StaticLogFileName value="true" /> <MaxSizeRollBackups value="10" /> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> <layout type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%d [%t] %-5p %c{1} - %m%n" /> </layout> <filter type="log4net.Filter.LevelRangeFilter"> <param name="LevelMin" value="DEBUG" /> </filter> <filter type="log4net.Filter.DenyAllFilter" /> </appender>
The problem is that if the process happens to run over midnight (e.g. starts at 11pm, runs for 2 hours), the first message after midnight causes the logfile to be truncated without being renamed first. The first message in the file is from just past midnight.
Is this a known bug? I didn't find anything in the mail list archives. -thanks, Barney Moss
============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.csfb.com/legal_terms/disclaimer_external_email.shtml
==============================================================================
|
|
|
|
|
Matthew Brown
 |
| 11/15/2005 2:23 PM |
|
You should remove <StaticLogFileName value="true" /> . I think the documentation might be a little confusing, but in my experience, under this setting the RollingFileAppender will only write to that one file, and not make any backups.
|
|
|
|
|
Nicko Cadell
 |
| 12/12/2005 5:43 PM |
|
Setting the StaticLogFileName property to true means that the current file will be called 'CAPS_DMS.log' and will be renamed when the rolling period is up. If StaticLogFileName is false then the current file will already be named with the start of the date range period.
If the file is being overwritten rather than rolled at the date boundary then it is likely that the app does not have permission to rename the file. You should run with log4net internal debug enabled to see any error messages that log4net encounters.
http://logging.apache.org/log4net/release/faq.html#internalDebug
Nicko
|
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.7
|