JonathanM
JonathanM

Reputation: 37

On the fly compression of logger files

I'm using Java's Log manager (java.util.logging). I've created "FileHandler" and set a file count argument (to create new file when the log reaches maximum file limit (300 MB in this case).

I'd like to compress the files during its run (using rar for example), but can't only add the new files because the names of all the existing files are being incremented every time a new is one created. (logging.0 becomes logging.1, logging.1 becomes logging.2, etc...)

Is is possible to configure the FileHandler, in a way that the new file will be written to new name, and the recent files' name will remain?

Thanks!

Upvotes: 0

Views: 435

Answers (1)

jmehrens
jmehrens

Reputation: 11055

Currently there is no setting to control the order of the file name. You can subclass FileHander and listen for rotation by overriding setOutputStream You might be able to reorder the files during that call. Otherwise, you have to create or locate 3rd party handler.

Upvotes: 1

Related Questions