Slow log start time

In a very simple Java application, where logback uses the default values ​​(no logback.xml in src/main/resources ), the application starts in about 400 ms. As soon as we add the basic logback.xml to the class path ( src/main/resources ), the startup time increases to about 5500 ms. We have seen this in several projects. The configuration 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> 
+5
source share
2 answers

5 seconds looks like a DNS query timeout. That was for me. Just make sure the hostname of your computer is resolved ip. You can check what ping does:

 ping `hostname` 

If he resolves the name and starts pinging, your problem is something else. But if you see the message "bad address", this may explain your problem.

To fix this simply, you can simply add your hostname to the /etc/hosts . Just add the hostname at the end of the line, starting with 127.0.0.1. This change should be applied immediately. This may not be the cleanest way to fix this, especially on modern Linux with dhcp and so on. But if that works, you will have a good pointer on how to solve the name resolution problem forever.

+10
source

For me, the problem was ipv6 resolution. Damien's answer above was in place, all that was needed was to add an ipv6 entry to etc / hosts. Sort of:

 ::1 ${your.host.name} 
+6
source

All Articles