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 |
|
Ted Graham
 |
| 06/10/2004 10:19 PM |
|
We need to configure log4net to create a new log file each time our Windows Forms application starts. It seems like the RollingFileAppender should handle this, but I can't find an example that does this. The examples I find are all the same, keeping 10 logs of up to 100k each. Is there a way to configure log4net to create a new file each time the application starts, keeping the most recent 3? I'd also like to name the log files based on the start time.
We're using log4net 1.20-beta 8.
Thanks,
Ted |
|
|
|
|
Ted Graham
 |
| 06/14/2004 3:36 PM |
|
Is what I want to do possible with log4net? I've found that log4j has a DailyRollingFileAppender, but it doesn't appear that it was ported to log4net. Thoughts? Are the developers still active?
Thanks,
Ted |
|
|
|
|
Denis, Rich
 |
| 06/14/2004 4:46 PM |
|
The rollinglogfile appender does support rolling on days. But that still wont solve the problem that you were asking about unless that is default behavior for the rolling appender. I think it just appends to the same file if it is on the same date. It would be possible to have the app start write out a parsable string to know where the beginning is then write a console app that tears that into 3 files. Anyways just throwing that out there.
|
|
|
|
|
Nicko Cadell
 |
| 06/27/2004 8:13 PM |
|
Ted,
The RollingFileAppender is not designed to roll one file per run. It is designed to roll on either date boundaries or on file size during an application run.
If you need to have a unique file per run then you should subclass the FileAppender and override the OpenFile method to select the unique name for the log file for the current execution. You may be able to just use the process start time to give you a unique name.
Nicko
|
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.7
|