java如何关闭jetty调试?
我有一个运行jetty的java应用程序:
public class ServerRunner {
private final static org.apache.log4j.Logger logger = LoggingUtils.getLogger();
public static void main(String[] args) throws Exception {
PromptoConfig.s.initLog();
final int port = 8082;
final Server jettyServer = new Server(port);
final HandlerCollection handlers = new HandlerCollection();
// Creating the first web application context
final WebAppContext webappContext = new WebAppContext();
System.out.println("===== PromptoConfig.s.RESOURCES_BASE " + PromptoConfig.s.RESOURCES_BASE);
webappContext.setResourceBase(PromptoConfig.s.RESOURCES_BASE);
webappContext.setContextPath("/");
System.out.println("===== PromptoConfig.s.WEB_XML_PATH " + PromptoConfig.s.WEB_XML_PATH);
webappContext.setDefaultsDescriptor(PromptoConfig.s.WEB_XML_PATH);
// webappContext.setTempDirectory(new File(temp));
DBSQLConfig.s().DB = com.waze.prompto.config.DBSQLConfig.s.DB;
webappContext.setExtractWAR(false);
handlers.addHandler(webappContext);
// Adding the handlers to the server.
jettyServer.setHandler(handlers);
try {
jettyServer.start();
jettyServer.join();
} catch (Exception ex) {
logger.error("failed to init jetty server", ex);
} finally {
jettyServer.destroy();
}
}
}
我在intellij控制台的日志调试信息中看到:
633016 [org.eclipse.jetty.server.session.HashSessionManager@22fcf7abTimer] DEBUG org.eclipse.jetty.server.session - Scavenging sessions at 1496325042425
如何关闭此调试日志
# 1 楼答案
如果您使用eclipse中的jetty服务器
添加配置
在文件src/main/resources/log4j中。性质
# 2 楼答案
您似乎已经在您的环境中配置了log4j
输出格式也不是Jetty内部
StdErrLog
的默认格式你的
码头标准日志
此时,这不再是jetty日志记录配置,而是log4j配置
只需在
log4j.properties
或log4j.xml
中将org.eclipse.jetty
记录器级别设置为INFO或WARN即可