From Ceki's Mar 3rd, 2014 comment on the Java Bien! blog:
As for logback start up time, I think that resolving the local host name might be responsible for the delay more than the class load time. In any case, I agree that 200 ms to load the logback config file may be somewhat excessive.
A few details about my application:
- Without logback on the classpath, my application starts up in ~275ms.
- With logback on the classpath—and without any configuration files—my application starts up in ~375ms.
- With a logback.xml configuration on the classpath, my application starts up in ~450ms.
So logback is adding between 100 and 175 ms of startup time, depending on whether there is a logback.xml file present. I can deal with the initial extra 100ms, but once startup time reaches the ~450ms mark, it creates a very noticeable lag. This is a command-line application intended to be run many times per day by users, so startup time really matters.
I have not profiled the application to see where the hotspots actually lie, but if the hostname lookup is indeed a major contributor to the problem, perhaps it could be made optional.
Otherwise, anything that can be done to reduce logback startup time to a minimum would be appreciated.