当前位置:   article > 正文

slf4j日志配置

slf4j日志配置

Flink本地运行时需配置slf4j日志,生成日志文件或在控制台直接输出日志

依赖

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.21</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.21</version>
        </dependency>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

log4j.properties

#log4j.rootLogger=INFO,console,dailyFile,rollingFile,logFile
log4j.rootLogger=INFO,console,dailyFile
log4j.additivity.org.apache=true

# 控制台(console)
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=DEBUG
log4j.appender.console.ImmediateFlush=true
log4j.appender.console.Target=System.err
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%p] %m%n

## 日志文件(logFile)
#log4j.appender.logFile=org.apache.log4j.FileAppender
#log4j.appender.logFile.Threshold=DEBUG
#log4j.appender.logFile.ImmediateFlush=true
#log4j.appender.logFile.Append=true
#log4j.appender.logFile.File=D:/logs/log.log4j
#log4j.appender.logFile.layout=org.apache.log4j.PatternLayout
#log4j.appender.logFile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%p] %m%n

## 滚动文件(rollingFile)
#log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
#log4j.appender.rollingFile.Threshold=DEBUG
#log4j.appender.rollingFile.ImmediateFlush=true
#log4j.appender.rollingFile.Append=true
#log4j.appender.rollingFile.File=D:/logs/log.log4j
#log4j.appender.rollingFile.MaxFileSize=200KB
#log4j.appender.rollingFile.MaxBackupIndex=50
#log4j.appender.rollingFile.layout=org.apache.log4j.PatternLayout
#log4j.appender.rollingFile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%p] %m%n

# 定期滚动日志文件(dailyFile)
#log4j.appender.dailyFile=org.apache.log4j.DailyRollingFileAppender
#log4j.appender.dailyFile.Threshold=INFO
#log4j.appender.dailyFile.ImmediateFlush=true
#log4j.appender.dailyFile.Append=true
#log4j.appender.dailyFile.File=D:\\Program Files (x86)\\WorkspaceIDEA\\FlinkStu\\flink.log
#log4j.appender.dailyFile.DatePattern='.'yyyy-MM-dd
#log4j.appender.dailyFile.layout=org.apache.log4j.PatternLayout
#log4j.appender.dailyFile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%p] %m%n
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/595054
推荐阅读