java 2024-08-19

What is the correct way to set log levels programmatically (i.e. from input params) without becoming dependent on an implementation? I am now using slf4j api in my java library but the same codebase serves as a CLI utility which needs to be able to set log levels ...

Rupert (Sevva/All Street) 2024-08-22T08:09:48.495359Z

If you use dependency injection (e.g. Spring) then you can inject and configure any logger without hard coupling to it.

I think thats always implementation dependent

the cli frontend part should be a seperately distributed lib which pulls in a logging impl