Jetty: how to disable logging?

Viewed 22072

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?

9 Answers

In Jetty Embedded you can try: org.mortbay.log.Log.setLog(null); Before call Server.

Use this

org.eclipse.jetty.util.log.Log.setLog(new jettyNoLog());
Logger.getLogger(jettyNoLog.class.getName()).setLevel(Level.OFF);
org.eclipse.jetty.util.log.Log.getProperties().setProperty("org.eclipse.jetty.LEVEL", "OFF");
org.eclipse.jetty.util.log.Log.getProperties().setProperty("org.eclipse.jetty.util.log.announce", "false");
org.eclipse.jetty.util.log.Log.getRootLogger().setDebugEnabled(false);

Before starting the server, call:

org.eclipse.jetty.util.log.StdErrLog logger = new org.eclipse.jetty.util.log.StdErrLog();
logger.setLevel(org.eclipse.jetty.util.log.StdErrLog.LEVEL_OFF);
org.eclipse.jetty.util.log.Log.setLog(logger);

This is basically the same as in the answer by arcuri82, but without the remaining single log line, which logger is used.

Add configuration

log4j.category.org.eclipse.jetty=error

in the file src/main/resources/log4j.properties

Related