I am trying to embed Jetty 6.1 in another program. Jetty is dumping INFO-log information and I need to turn it off. Is there a simple way to disable logging programmaticaly?
A more concise version of Jeff Chern's answer:
org.eclipse.jetty.util.log.Log.setLog(new NoLogging())
.
import org.eclipse.jetty.util.log.Logger;
public class NoLogging implements Logger {
@Override public String getName() { return "no"; }
@Override public void warn(String msg, Object... args) { }
@Override public void warn(Throwable thrown) { }
@Override public void warn(String msg, Throwable thrown) { }
@Override public void info(String msg, Object... args) { }
@Override public void info(Throwable thrown) { }
@Override public void info(String msg, Throwable thrown) { }
@Override public boolean isDebugEnabled() { return false; }
@Override public void setDebugEnabled(boolean enabled) { }
@Override public void debug(String msg, Object... args) { }
@Override public void debug(Throwable thrown) { }
@Override public void debug(String msg, Throwable thrown) { }
@Override public Logger getLogger(String name) { return this; }
@Override public void ignore(Throwable ignored) { }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With