oym
oym

Reputation: 7083

log4j rolling appender overwrite on restart

Using the rolling file appender in the log4j config I have it properly rolling over log files daily.

The problem is that when the server is restarted, for whatever reason, I am losing all the logs for that day from before the restart. I think what is happening is that after restart, server.log is getting overwritten when the new log statements start coming, so when the file is rolledover at midnight all that remains are the log statements from after the restart.

I'd really like to have the logs leading up to whatever problem forced the restart. Any ideas how to correct this?

Upvotes: 1

Views: 2256

Answers (1)

MaDa
MaDa

Reputation: 10772

Perhaps this is a naive question, but did you set the "Append" parameter of the appender to true?

<appender name="app" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="Append" value="true" />
</appender>

Upvotes: 2

Related Questions