Re: IMPOSSIBLE to do this with LOG4J



ProgDario wrote:
... log the application events with a rotation file
appenderm, a new file is created when the previous file reachs a
certain size.

Which matches RollingFileAppender.

The subtle thing is that when the maximum number of file is reached,
the old one must me deleted and a new file has to be created.

Still matches RollingFileAppender.

Morover, every file name must contain the date time in its path.

If the current file need not have this, this matches DailyRollingFileAppender.

So if the file size limit is 4 and a new file is created, the first
file is erased, and the new file name created contains the date/time
detail:

[FileName_29-04-05_12:12:12.log] -> erased
FileName_29-04-05_12:17:05.log
FileName_29-04-05_12:22:45.log
FileName_29-04-05_12:35:45.log
FileName_29-04-05_12:50:01.log -> new file created

Apache is open source.

Look at the two [RollingFileAppender, DailyRollingFileAppender].
Maybe you can figure out how to implement a combination of the two.

Have a look at existing 3rd party extensions
<http://logging.apache.org/log4j/docs/download.html>
maybe someone already did it.
.