log4net clear log file

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
 
M

Michael Nemtsev

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
 
G

Guest

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
 
M

Mike Blake-Knox

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top