[logback-user] Trouble with Logback / JUL configuration

Flavio Donzé flavio.donze at gmail.com
Wed Jun 17 15:12:57 CEST 2009


Hi Ceki

Thanks for your reply, here how I solved it:

URL logging = context.getBundle().getResource("logging.properties");
if (logging == null) {
	throw new IOException("logging.properties not found in
com.softmodeler.osgi.over.slf4j");
}
InputStream inputStream = logging.openStream();
LogManager.getLogManager().readConfiguration(inputStream);

SLF4JBridgeHandler.install();

The loaded logging.properties contains only one line: .level= FINEST
Now I get all the messages over logback, JUL does not print anything.

Cheers
flavio

-----
Flavio Donzé
Software Engineer
My Blog:  http://swissdev.blogspot.com/

-----Ursprüngliche Nachricht-----
Von: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] Im
Auftrag von Ceki Gulcu
Gesendet: Mittwoch, 17. Juni 2009 13:35
An: logback users list
Betreff: Re: [logback-user] Trouble with Logback / JUL configuration




Flavio Donzé wrote:
> 
> “This handler will redirect jul logging to SLF4J. However, only logs 
> enabled in j.u.l. will be redirected. For example, if a log statement 
> invoking a j.u.l. logger disabled that statement, by definition, will 
> not reach any SLF4JBridgeHandler instance and cannot be redirected”

Hello Flavio,


When you log using a jul logger, the jul logger gets invoked, and if
it is enabled for the level with which it was invoked, and if
SLF4JBridgeHandler was installed, then logs would go to SLF4J.

In your example, you are using the FINE, FINER and FINEST levels which
are all disabled by default (in jul). You just need to enable them by
modifying the logging.properties file in use by your JVM. See
$JAVA_HOME/lib/logging.properties wherer $JAVA_HOME is the folder
where you installed your JDK.

HTH,



-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for
Java.
http://logback.qos.ch
_______________________________________________
Logback-user mailing list
Logback-user at qos.ch
http://qos.ch/mailman/listinfo/logback-user



More information about the Logback-user mailing list