In a very simple Java application, with logback using default values (no logback.xml
in src/main/resources
), the application starts up in around 400ms. As soon as we add a basic logback.xml
to the classpath (src/main/resources
), the start up time increases to around 5500ms. We have seen this in multiple projects. The config is as follows:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%date{HH:mm:ss.SSS} %-7level - %-50logger{36} - %message%n</pattern>
</encoder>
</appender>
<logger name="com.zaxxer.hikari" level="ERROR">
<appender-ref ref="STDOUT"/>
</logger>
<logger name="org.sql2o" level="ERROR">
<appender-ref ref="STDOUT"/>
</logger>
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
Log4J comes out the clear winner here, being able to write almost 270% more lines than JUL, 12.5% more than logback, 52% more than SLF4J SL.
The maxHistory property controls the maximum number of archive files to keep, deleting older files. For example, if you specify monthly rollover, and set maxHistory to 6, then 6 months worth of archives files will be kept with files older than 6 months deleted.
Size-based rolling policy allows to rollover based on file on each log file. For example, we can rollover to a new file when the log file reaches 10 MB in size. The maxFileSize is used to specify the size of each file when it gets rolled over.
5 seconds looks like a dns query timeout. It was the case for me. Just be sure that the hostname of your computer resolve to an ip. You can test that doing a ping:
ping `hostname`
If it resolve the name and start pinging, your problem is something else. But if you see a message saying "bad address", this may explain your problem.
To fix it simply, you can just add your hostname to the /etc/hosts
file. Just add the hostname at the end of the line starting with 127.0.0.1.
The change should apply immediately. It may not be the cleanest way to fix that, especially on modern linux with dhcp and so on. But if it works, you'll have a good pointer to how to solve this name resolution issue permanently.
For me the issue was ipv6 resolution. Damien's answer above was spot on, only needed to add an ipv6 entry to etc/hosts. Something like:
::1 ${your.host.name}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With