As far as I know http4k doesn't do any logging by ...
# http4k
j
As far as I know http4k doesn't do any logging by itself, because it doesn't have dependencies on logging frameworks, and in any case, it doesn't know how you might want to log stuff, or even if you want to. Many people have moved far away from log4j and the like, and instead emit structured events when things happen, just to stdout, that are collected by fluentd or similar. There are a few examples of structured logging in the cookbook https://www.http4k.org/cookbook/structured_logging_with_events/ If you would like to log lines with log4j, slf4j, java logging or whatever its easy to add a filter that uses your local logging library natively. I think there are some examples in https://www.http4k.org/cookbook/monitoring/
b
Thank you. Am I correct that the
CatchAll
filter returns the stacktrace to the caller in the http response, not stdout? I’m just used to the pattern where if you have an uncaught exception, it ends up in a stdout (which is what I mean by logging). It seems that in a vanilla setup, exceptions, nor anything ends up in stdout. I just wanted to make sure I’m not missing something. This does make sense to me. It requires the developer to be explicit about the behavior around exceptions, and implementing a top level handler.
j
Yeah, by making everything explicit, you don't have to do work to take stuff away you don't want! Your code has only stuff in it that you explicitly chose to put there, no surprises