I have a Compojure app generated using Luminus. I want to configure logging using clj-logging-config but I'm struggling mightily with this. I put the (!set-logger)
command in the init
function (declared with {:ring {:init}
in project.clj
) but I can't explain the behavior.
If I just say (!set-logger)
then it logs stuff. If I say (set-logger! :pattern "%d - %m%n")
then it complains:
log4j:WARN No appenders could be found for logger (example.routes.home).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Setting the log level doesn't seem to have any effect.
Moving the (!set-logger)
to the top of different modules seems to cause those modules to log as expected, but I'm failing to find the right place to put a single (!set-logger)
with all the parameters I want and have it affect the whole application.
So this seems to work:
(set-loggers!
:root {
:level :debug
:pattern "%d - [%p] %m%n"
}
)
My assumption was that set-logger!
by default sets the root logger. I guess that is incorrect?