Thanks for the advice.

Can you please tell me how can i only keep the last 7 days of the log ?

Thank you.


On 11/21/06, Curt Arnold <[EMAIL PROTECTED]> wrote:

On Nov 21, 2006, at 4:21 PM, ying lcs wrote:

> Hi,
>
> Can you please tell me how can I configure file appender so that it
> writes to 1 log file per data and have the old one stays?
>
> Thank you.
>

I guessing that you meant "1 log file per DAY".  If that is your
request, you could use a DailyRollingFileAppender which would write
all log messages to a file which would be renamed after the day
changes.   The configuration would looks something like:


log4j.rootLogger=DEBUG, drfa
log4j.appender.drfa=org.apache.log4j.DailyRollingFileAppender
log4j.appender.drfa.file=mylog.log
log4j.appender.drfa.Append=false
log4j.appender.drfa.layout=org.apache.log4j.PatternLayout
log4j.appender.drfa.layout.ConversionPattern=%m\n

Messages would be logged to mylog.log and after the day changes the
file would be close, renamed mylog.log.2006-11-21 and subsequent
logging would be captured in a new mylog.log file.

There has been some development of a MultiFileAppender that could
actually write the file in place and would not require renaming the
file, but that isn't working yet.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to