zoukankan      html  css  js  c++  java
  • log4j 配置

    maven 依赖:

     <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.25</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.25</version>
    </dependency>

    reources 文件夹里面添加 log4j.properties

    log4j.rootLogger=info, ServerDailyRollingFile, stdout
    log4j.appender.ServerDailyRollingFile=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.ServerDailyRollingFile.DatePattern='.'yyyy-MM-dd
    log4j.appender.ServerDailyRollingFile.File=logs/notify-subscription.log
    log4j.appender.ServerDailyRollingFile.layout=org.apache.log4j.PatternLayout
    log4j.appender.ServerDailyRollingFile.layout.ConversionPattern=%d - %m%n
    log4j.appender.ServerDailyRollingFile.Append=true
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p [%c] %m%ns

    示例:

    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    
    public class Tutorial {
    
        private static final transient Logger LOGGER = LoggerFactory.getLogger(Tutorial.class);
    
        public static void main(String[] args) {
            LOGGER.info("this is log4j tutorial");
            System.exit(0);
        }
    }
  • 相关阅读:
    Dropplets – 极简的 Markdown 博客平台
    T3
    Awesomplete
    SVG Drawing Animation
    Dom Animator – 提供 Dom 注释动画的 JS 库
    Electron
    很赞的效果!互动的页面元素拖放着色实验
    BookBlock
    雷军投资的理财网站,年化收益13%!
    Rainyday.js – 使用 JavaScript 实现雨滴效果
  • 原文地址:https://www.cnblogs.com/chenmz1995/p/10319236.html
Copyright © 2011-2022 走看看