tags:

views:

987

answers:

1

How do I programmatically configure Jetty's logger? I'm using Jetty in a standalone application and want to change the log level of some of Jetty's internally generated warnings. Ideally I could do this programmatically (ie, in code) without having to specify an XML file.

I'm using Jetty 6.1.20.

+1  A: 

Jetty uses slf4j, so you can use any logging framework or slf4j implementation you want .

Jetty comes with the Simple slf4j implementation, which logs INFO levels or above. So, you either change the bundled slf4j jars to an implementation with the log levels you want, or use a bridge to another framework with the levels you want, or provide a custom log class you can set via, for example,

System.setProperty("org.mortbay.log.class", "com.example.JettyLog");

More information here.

Vinko Vrsalovic