• ##log4j日志


    当我们用springboot整合log4j的时候需要添加一个log4j.properties的文件

    #log4j.rootLogger=CONSOLE,info,error,DEBUG
    log4j.rootLogger=info,error,CONSOLE,DEBUG
    log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender     
    log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout     
    log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd-HH-mm} [%t] [%c] [%p] - %m%n     
    log4j.logger.info=info
    log4j.appender.info=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.info.layout=org.apache.log4j.PatternLayout     
    log4j.appender.info.layout.ConversionPattern=%d{yyyy-MM-dd-HH-mm} [%t] [%c] [%p] - %m%n  
    log4j.appender.info.datePattern='.'yyyy-MM-dd
    log4j.appender.info.Threshold = info   
    log4j.appender.info.append=true   
    #log4j.appender.info.File=/home/admin/pms-api-services/logs/info/api_services_info
    log4j.appender.info.File=/Users/dddd/Documents/testspace/pms-api-services/logs/info/api_services_info
    log4j.logger.error=error  
    log4j.appender.error=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.error.layout=org.apache.log4j.PatternLayout     
    log4j.appender.error.layout.ConversionPattern=%d{yyyy-MM-dd-HH-mm} [%t] [%c] [%p] - %m%n  
    log4j.appender.error.datePattern='.'yyyy-MM-dd
    log4j.appender.error.Threshold = error   
    log4j.appender.error.append=true   
    #log4j.appender.error.File=/home/admin/pms-api-services/logs/error/api_services_error
    log4j.appender.error.File=/Users/dddd/Documents/testspace/pms-api-services/logs/error/api_services_error
    log4j.logger.DEBUG=DEBUG
    log4j.appender.DEBUG=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.DEBUG.layout=org.apache.log4j.PatternLayout     
    log4j.appender.DEBUG.layout.ConversionPattern=%d{yyyy-MM-dd-HH-mm} [%t] [%c] [%p] - %m%n  
    log4j.appender.DEBUG.datePattern='.'yyyy-MM-dd
    log4j.appender.DEBUG.Threshold = DEBUG   
    log4j.appender.DEBUG.append=true   
    #log4j.appender.DEBUG.File=/home/admin/pms-api-services/logs/debug/api_services_debug
    log4j.appender.DEBUG.File=/Users/dddd/Documents/testspace/pms-api-services/logs/debug/api_services_debug
    
    log4j代码
    private static final Logger logger = LoggerFactory.getLogger(IndexController.class);
  • 相关阅读:
    EF-一对一关系
    EF-生成迁移版本
    打包、压缩指令
    gut pull 拉取出错
    nohup的使用方法
    fopen打开文件出错
    实现多线程下载图片到本地③
    实现单线程下载图片到本地②
    服务器重装系统后终端登录不上去
    简单实现图片抓取下载到本地①
  • 原文地址:https://www.cnblogs.com/liurui-bk517/p/11634063.html
Copyright © 2020-2023  润新知