Closed pjlegato closed 3 years ago
@pjlegato Hi Paul, this'll be because of the "UnknownHost" you're seeing there.
Timbre will attempt to fetch your Hostname, and try for up to 5 seconds before giving up. Then the result is cached for a minute.
If you can fix whatever's causing the Hostname lookup to block and fail, then this delay will go away.
Cheers!
Thanks for the pointer.
It appears that MacOS (Sierra and later) do a reverse DNS lookup by default when java.net.InetAddress/getLocalHost
is called. Someone made a tester at https://github.com/thoeni/inetTester .
As a workaround, you can add your hostname to /etc/hosts
manually, as per https://stackoverflow.com/questions/39636792/jvm-takes-a-long-time-to-resolve-ip-address-for-localhost/39698914#39698914 . This solved my immediate issue. I'm not sure whether there's a better underlying solution.
There appear to be many similar issues with other JVM projects, e.g. https://github.com/spring-projects/spring-boot/issues/7087
Thanks for adding the extra info Paul 👍
It's not obvious to me that there's anything Timbre could or should try do from its end about this, so I'm inclined to close and suggest that others running into the same issue take the same steps (to add a hostname to /etc/hosts
).
But you or anyone else reading: please feel free to reopen if you have a practical idea of something that Timbre could do to help blunt this sharp edge.
Cheers! :-)
I'm trying out Timbre as per the instructions in the README, just trying to log to STDOUT or STDERR, nothing fancy. I did the
project.clj
dependency to[com.taoensso/timbre "5.1.0"]
. It works fine, except that the very first call to log something takes >5 seconds. The rest then seem normal.Did I miss some critical configuration step somewhere?