There is no way using straight slf4j to set the Logger level, as slf4j is just a log facade/routing API.
You would need to rely on the underlying logging implementation to set the logging level on the namespace "org.eclipse.jetty"
Such as:
If using slf4j-simple.jar, and the SimpleLogger, then you cannot set the level programmatically, only via System properties once the SimpleLogger is initialized, which is very early in the JVM.
If using slf4j-log4j.jar, use the Log4j specific techniques.
org.apache.log4j.LogManager.getLogger("org.eclipse.jetty").setLevel(Level.WARN);
- If using slf4j-jdk14.jar, use the java.util.logging techniques.
java.util.logging.LoggerFactory.getLogger("org.eclipse.jetty").setLevel(Level.WARNING);
- If using logback.jar, cast the slf4j Logger to the logback Logger and then set the Level.
final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger("org.eclipse.jetty");
if (!(logger instanceof ch.qos.logback.classic.Logger)) {
return;
}
ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) logger;
logbackLogger.setLevel(ch.qos.logback.classic.Level.WARN);