简体   繁体   English

我如何关闭码头调试?

[英]how can i turn off jetty debuging?

I have a java app that runs 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();
        }
    }
}

i see in the logs debug info in intellij console: 我在intellij控制台的日志调试信息中看到:

633016 [org.eclipse.jetty.server.session.HashSessionManager@22fcf7abTimer] DEBUG org.eclipse.jetty.server.session  - Scavenging sessions at 1496325042425

How can i turn this debug logs off? 如何关闭此调试日志?

You appear to have configured log4j on your environment. 您似乎已在您的环境中配置了log4j。

private final static org.apache.log4j.Logger logger = LoggingUtils.getLogger();

The output format is also not the default format from Jetty's internal StdErrLog 输出格式也不是Jetty内部StdErrLog的默认格式

Yours 你的

633016 [org.eclipse.jetty.server.session.HashSessionManager@22fcf7abTimer] DEBUG org.eclipse.jetty.server.session  - Scavenging sessions at 1496325042425

Jetty's StdErrLog 码头的StdErrLog

2017-06-01 14:30:17.978:DBUG:oejs.session:main: SessionManager default maxInactiveInterval=1800

At this point, this is no longer a jetty logging configuration, but a log4j configuration. 此时,这不再是码头日志记录配置,而是log4j配置。

Just set the org.eclipse.jetty logger level to INFO or WARN in your log4j.properties or log4j.xml 只需在log4j.propertieslog4j.xml中将org.eclipse.jetty记录器级别设置为INFO或WARN

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM