How to programmatically determine when a rollover happened in log4j? -


i attempting use log4j write csv files. csv header must written top of log file every time created. example, of these rolled files must have following first line in log file:

log.0 timestamp, name, min, max

log.1 timestamp, name, min, max

log.2 timestamp, name, min, max

is possible determine when rollover has occurred can append header?

thanks.

p.s: know there lots of open source csv writers prefer not use them because use existing log functionality in our software.

if @ log4j documentation rollingfileappender, has method called rollover.

http://logging.apache.org/log4j/1.2/apidocs/index.html

you need implement custom file appender inherits rollingfileappender, , override rollover method. imagine call super.rollover, , write whatever want header new file before gets logged it.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -