log4net clear log file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,
I am using log4net in my (.net v1.1) application to log the messages. I
tried to clear the logfile while application is running. since log4net has
the file handle it did not allow me to clear/delete the file. I need to clear
the content of the log file specified in the log4net configuration file, when
it is needed in the application(such as some button click event), If anybody
familiar with log4net your help would be appriciated...

--Dhans
 
Hello Dhans,

I don't use log4net for several month, but there was a option of log4net
config's file where you can specify what to do with log - override or append.
Look through doc carefully

D> Hi there,
D> I am using log4net in my (.net v1.1) application to log the messages.
D> I
D> tried to clear the logfile while application is running. since
D> log4net has
D> the file handle it did not allow me to clear/delete the file. I need
D> to clear
D> the content of the log file specified in the log4net configuration
D> file, when
D> it is needed in the application(such as some button click event), If
D> anybody
D> familiar with log4net your help would be appriciated...
D> --Dhans
D>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
Hi Michael,
Thanks for your response. In my config I have selected append option. It is
not related to config file. I need to clear the content of the log file when
ever i need to do from the application while it is running.

Is there any newsgroup for log4net or where i can get help on that?

--Dhans
 
Dhans said:
I need to clear the content of the log file when
ever i need to do from the application while it is running.

You could try using the RollingFileAppender which can switch to a
different file based on date/time or log file size.

That allows you to at least delete older logs.

Mike
 
Back
Top