提供一段log4j2应用的properties配置文档的代码实例
时间: 2024-05-16 09:14:54 浏览: 80
以下是一个log4j2应用的properties配置文档的代码实例:
```
# 设置根日志级别为INFO,输出到控制台和文件
rootLogger.level = INFO
rootLogger.appenderRef.console.ref = STDOUT
rootLogger.appenderRef.file.ref = File
# 控制台输出
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%t] [%-5p] %c{1}:%L - %m%n
# 文件输出
appender.file.type = RollingFile
appender.file.name = File
appender.file.fileName = logs/app.log
appender.file.filePattern = logs/app-%d{yyyy-MM-dd}.log
appender.file.layout.type = PatternLayout
appender.file.layout.pattern = [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%t] [%-5p] %c{1}:%L - %m%n
appender.file.policies.type = Policies
appender.file.policies.time.type = TimeBasedTriggeringPolicy
appender.file.policies.time.interval = 1
appender.file.policies.time.modulate = true
appender.file.strategy.type = DefaultRolloverStrategy
appender.file.strategy.max = 10
# 设置com.example包的日志级别为DEBUG
logger.com.example.name = com.example
logger.com.example.level = DEBUG
```
阅读全文