How do I make log4j create log files on demand only?

Posted by Mirvnillith on Stack Overflow See other posts from Stack Overflow or by Mirvnillith
Published on 2010-04-27T08:50:04Z Indexed on 2010/04/27 8:53 UTC
Read the original article Hit count: 214

Filed under:

We have a modular application where modules have their own log4j logs (i.e. communication log and error log). The appenders and categories for these are all configured in the core log4j XML, but not all modules are always installed. The DailyRollingFileAppender creates its file regardless of use and that exposes the full set of modules although not present and as some of them are customer specific we'd like to hide logs not in use. Is there a way to make DailyRollingFileAppender create its file on first use instead of automatically at startup?

© Stack Overflow or respective owner

Related posts about log4j