Erik
Erik

Reputation: 19

Programmatic configuration of Apache Commons Logging

I want to include an external library in my Java project, and this library in particular uses Apache Commons Logging to write messages to the logging system. The library writes a lot of messages of level "info", causing a lot of useless entries in the logs.

My application is supposed to be deployed and executed in a shared environment (for example, tomcat or jetty). My question is, what options do I have to configure the log level for this library if I cannot rely on properties/xml configuration files?

Upvotes: 1

Views: 1033

Answers (1)

Tomasz Nurkiewicz
Tomasz Nurkiewicz

Reputation: 340993

Apache Commons Logging is not really a logging library, it's just a facade that delegates to the underlying logging library like Log4J or java.util.logging. So first you have to discover which library are you actually using. Depending on that different configuration options apply.

My suggestion is to add replace commons-logging.jar with SLF4J bridge and then use whichever framework you want.

Upvotes: 4

Related Questions