[slf4j-user] Problem configuring an SLF4J logger

Heiner Westphal susp48 at verit.de
Mon Aug 8 10:12:11 CEST 2005


Hi there!

I just switched a project to slf4j (from apache-commons-logging)
and it was quite easy having "perl -pi" and eclipse 3.1 to aid.

BUT: I would like to have a way to configure the log level,
preferrably of the root logger, without having to know up front,
which logging implementation will be used.

This problem existed with commons-logging as well, IIRC.

Do you plan to add something like Logger.setLevel?
Or is there a way to know, which loggering framework is
in use at runtime?

Maybe I'm approaching the solution of my problem the wrong way
round, so I'll better explain it:

We got an application, which can be run stand alone or from an
eclipse-plugin which optionaly delivers a log file in a format
suitable for display in the eclipse TPTP LogView
(http://www.eclipse.org/tptp/).

The easiest way to get to that format seems to be using java1.4
logging with an adapter/formatter emitting CommonBaseEvent XML.
The log4j-formatter provided by tptp-4.0.0 is too generic, to
be useful and I try to avoid implementing a new one from scratch.

Now I switched to slf4j to use the java1.4 logging framework, whith
minimal changes to the logging api we already used, which had
been commons-logging, until we got into the well known class loader
nightmare (just imagine eclipse plugins using hivemind to access their 
respective plugins - outcome depends on order of initialization, ...).

Said application allows you to specify a log level to control the amount
and granularity of output.

Now I would like to allow the deployer to choose the logging framework
used while the application should still be able to change verbosity
programatically.

Any hint, how to accomplish this?

Thanks in advance,

Heiner




More information about the slf4j-user mailing list