Re: Defer evaluation of FileAppender filename until file is opened?

2020-02-04 Thread Doug Wegscheid
Found it: need to make sure we have a key for the route, even if it won't be used. Added pattern="x" to

Re: Defer evaluation of FileAppender filename until file is opened?

2020-02-04 Thread Doug Wegscheid
That looks promising, but I am having an issue with the RoutingAppender throwing an NPE when the first event gets past the filter on the RoutingAppender: 2020-02-05 02:38:08,798 Log4j2-TF-1-AsyncLogger[AsyncContext@2cdf8d8a]-1 ERROR An exception occurred processing Appender MyRoute java.lang.Nu

Re: Defer evaluation of FileAppender filename until file is opened?

2020-02-04 Thread Ralph Goers
Yes, so your best bet is to use the RoutingAppender and only supply a default Route. The Appender itself will only be created when something is logged to the Route. Ralph > On Feb 4, 2020, at 6:55 PM, Doug Wegscheid wrote: > > yes, that works as designed, but does not resolve my problem. The

Re: Defer evaluation of FileAppender filename until file is opened?

2020-02-04 Thread Doug Wegscheid
yes, that works as designed, but does not resolve my problem. The filename is not evaluated when the first event is written (after we have a good date/time), it's evaluated when log4j2 is configured (which is before when we have a good date/time set). On Tuesday, February 4, 2020, 08:19:16

Re: Defer evaluation of FileAppender filename until file is opened?

2020-02-04 Thread Ralph Goers
The FileAppender has an option named createOnDemand. If you set it to true then the file will only be created when a log event is written to it. See http://logging.apache.org/log4j/2.x/manual/appenders.html#FileAppender . R

Defer evaluation of FileAppender filename until file is opened?

2020-02-04 Thread Doug Wegscheid
I am trying to have log4j2 write log files with names mmdd-HHMMSS.log, but not start writing the file until we have a good system time (>year 1986). I have an application running on a system that boots up, and takes a while to get the correct time; until that happens, the system thinks it