• Java log4j


                <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
                <version>1.2</version>
                </dependency>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                    <version>1.7.25</version>
                    <scope>test</scope>
                </dependency>
    log4j.rootLogger=INFO, stdout
    
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
    
    log4j.tracer.infoLogger = INFO, stdout, A1
    log4j.additivity.infoLogger = false
    log4j.appender.A1 = org.apache.log4j.DailyRollingFileAppender
    log4j.appender.A1.File = ${catalina.home}/logs/A-Info.log
    log4j.appender.A1.DatePattern = '.'yyyy-MM-dd
    log4j.appender.A1.Threshold = INFO
    log4j.appender.A1.Append = true
    log4j.appender.A1.layout = org.apache.log4j.PatternLayout
    log4j.appender.A1.layout.ConversionPattern = %d %p [%t] %c %m%n
    
    log4j.tracer.errorLogger = ERROR, stdout, A2
    log4j.additivity.errorLogger = false
    log4j.appender.A2 = org.apache.log4j.DailyRollingFileAppender
    log4j.appender.A2.File = ${catalina.home}/logs/A-Error.log
    log4j.appender.A2.DatePattern = '.'yyyy-MM-dd
    log4j.appender.A2.Threshold = ERROR
    log4j.appender.A2.Append = true
    log4j.appender.A2.layout = org.apache.log4j.PatternLayout
    log4j.appender.A2.layout.ConversionPattern = %d %p [%t] %c %m%n
    
    log4j.tracer.Job = INFO, ERROR, stdout, A3
    log4j.additivity.Job = false
    log4j.appender.A3 = org.apache.log4j.DailyRollingFileAppender
    log4j.appender.A3.File = ${catalina.home}/logs/A-Job.log
    log4j.appender.A3.DatePattern = '.'yyyy-MM-dd
    log4j.appender.A3.Threshold = INFO, ERROR
    log4j.appender.A3.Append = true
    log4j.appender.A3.layout = org.apache.log4j.PatternLayout
    log4j.appender.A3.layout.ConversionPattern = %d %p [%t] %c %m%n
    package org.rx;
    
    import org.slf4j.LoggerFactory;
    
    public final class Logger {
        private static final org.slf4j.Logger log1 = LoggerFactory.getLogger("infoLogger"),
                log2 = LoggerFactory.getLogger("errorLogger");
        //private static final Log log1 = LogFactory.getLog("infoLogger"), log2 = LogFactory.getLog("errorLogger");
    
        public static void debug(String format, Object... args) {
            String msg = args.length == 0 ? format : String.format(format, args);
            System.out.println(msg);
            log1.debug(msg);
        }
    
        public static void info(String format, Object... args) {
            String msg = args.length == 0 ? format : String.format(format, args);
            log1.info(msg + System.lineSeparator());
        }
    
        public static void error(Throwable ex, String format, Object... args) {
            String msg = args.length == 0 ? format : String.format(format, args);
            log2.error(String.format("%s%s %s", System.lineSeparator(), ex.getMessage(), msg), ex);
        }
    }
  • 相关阅读:
    http://home.cnblogs.com/
    关于JS中的JSON
    JQuery中阻止事件冒泡方式及其区别
    jQuery判断元素是否是隐藏的代码
    jquery 绑定动态元素
    Js数组的操作push,pop,shift,unshift等方法详细介绍
    Jquery获取checkbox属性checked为undefined
    javascript时间戳和日期字符串相互转换
    关于jQuery新的事件绑定机制on()的使用技巧
    jQuery.extend()、jQuery.fn.extend()扩展方法示例详解
  • 原文地址:https://www.cnblogs.com/Googler/p/7552315.html
Copyright © 2020-2023  润新知