DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=40145>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40145 Summary: PatternLayout - %r doesn't do what the documentation says. Product: Log4j Version: 1.2 Platform: All OS/Version: other Status: NEW Severity: minor Priority: P2 Component: Layout AssignedTo: log4j-dev@logging.apache.org ReportedBy: [EMAIL PROTECTED] According to the Javadocs: %r - Used to output the number of milliseconds elapsed since the start of the application until the creation of the logging event. In practice the initial time is actually initialised from when the PatternLayout class is loaded and the static initialisers are fired. Consider the following rather contrived and paraphrased example: public class MyClass { static final Logger logger = Logger.getLogger(MyClass.class); public static void main(String[] args) throws Exception { BasicConfigurator.configure(); Thread.sleep(10 * 1000); logger.info("Hello, World!"); } } The time reported at Hello, World is actually very close to zero. AFAIK it seems to be practically impossible to know the app/JVM launch-time, nonetheless it could be better. Solutions I guess would be for the configuration call or, probably better, one of the Logger.getLogger() calls initialised the time or forces load of the PatternLayout class-load? A workaround is to log something early and of course many apps do this so it isn't a noted problem. In practice this is probably not unique to any platform or possibly even version of Log4J. Do any of the other implementations suffer from the same problem. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]