Search in sources :

Example 1 with InternalLoggerFactory

use of org.jboss.netty.logging.InternalLoggerFactory in project traccar by tananaev.

the class Log method setupLogger.

public static void setupLogger(Config config) throws IOException {
    Layout layout = new PatternLayout("%d{" + DATE_FORMAT + "} %5p: %m%n");
    Appender appender = new DailyRollingFileAppender(layout, config.getString("logger.file"), "'.'yyyyMMdd");
    LogManager.resetConfiguration();
    LogManager.getRootLogger().addAppender(new NullAppender());
    logger = Logger.getLogger(LOGGER_NAME);
    logger.addAppender(appender);
    logger.setLevel(Level.toLevel(config.getString("logger.level"), Level.ALL));
    // Workaround for "Bug 745866 - (EDG-45) Possible netty logging config problem"
    InternalLoggerFactory.setDefaultFactory(new InternalLoggerFactory() {

        @Override
        public InternalLogger newInstance(String string) {
            return new NettyInternalLogger();
        }
    });
    Log.logSystemInfo();
    Log.info("Version: " + getAppVersion());
}
Also used : NullAppender(org.apache.log4j.varia.NullAppender) DailyRollingFileAppender(org.apache.log4j.DailyRollingFileAppender) Appender(org.apache.log4j.Appender) Layout(org.apache.log4j.Layout) PatternLayout(org.apache.log4j.PatternLayout) NullAppender(org.apache.log4j.varia.NullAppender) PatternLayout(org.apache.log4j.PatternLayout) InternalLoggerFactory(org.jboss.netty.logging.InternalLoggerFactory) DailyRollingFileAppender(org.apache.log4j.DailyRollingFileAppender) InternalLogger(org.jboss.netty.logging.InternalLogger) AbstractInternalLogger(org.jboss.netty.logging.AbstractInternalLogger)

Example 2 with InternalLoggerFactory

use of org.jboss.netty.logging.InternalLoggerFactory in project traccar by traccar.

the class Log method setupLogger.

public static void setupLogger(Config config) throws IOException {
    Layout layout = new PatternLayout("%d{" + DATE_FORMAT + "} %5p: %m%n");
    Appender appender = new DailyRollingFileAppender(layout, config.getString("logger.file"), "'.'yyyyMMdd");
    LogManager.resetConfiguration();
    LogManager.getRootLogger().addAppender(new NullAppender());
    logger = Logger.getLogger(LOGGER_NAME);
    logger.addAppender(appender);
    logger.setLevel(Level.toLevel(config.getString("logger.level"), Level.ALL));
    // Workaround for "Bug 745866 - (EDG-45) Possible netty logging config problem"
    InternalLoggerFactory.setDefaultFactory(new InternalLoggerFactory() {

        @Override
        public InternalLogger newInstance(String string) {
            return new NettyInternalLogger();
        }
    });
    Log.logSystemInfo();
    Log.info("Version: " + getAppVersion());
}
Also used : NullAppender(org.apache.log4j.varia.NullAppender) DailyRollingFileAppender(org.apache.log4j.DailyRollingFileAppender) Appender(org.apache.log4j.Appender) Layout(org.apache.log4j.Layout) PatternLayout(org.apache.log4j.PatternLayout) NullAppender(org.apache.log4j.varia.NullAppender) PatternLayout(org.apache.log4j.PatternLayout) InternalLoggerFactory(org.jboss.netty.logging.InternalLoggerFactory) DailyRollingFileAppender(org.apache.log4j.DailyRollingFileAppender) InternalLogger(org.jboss.netty.logging.InternalLogger) AbstractInternalLogger(org.jboss.netty.logging.AbstractInternalLogger)

Aggregations

Appender (org.apache.log4j.Appender)2 DailyRollingFileAppender (org.apache.log4j.DailyRollingFileAppender)2 Layout (org.apache.log4j.Layout)2 PatternLayout (org.apache.log4j.PatternLayout)2 NullAppender (org.apache.log4j.varia.NullAppender)2 AbstractInternalLogger (org.jboss.netty.logging.AbstractInternalLogger)2 InternalLogger (org.jboss.netty.logging.InternalLogger)2 InternalLoggerFactory (org.jboss.netty.logging.InternalLoggerFactory)2