name = PropertiesConfig
status = warn
property.log-path = E:/logs
appenders = rolling
appender.rolling.type = RollingFile
appender.rolling.name = rolAppender1
appender.rolling.fileName = ${log-path}/log1.log
appender.rolling.filePattern = ${log-path}/$${date:yyyy-MM}/Log-%d{dd-MMM-yyyy}-log1.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yyyy-MMM-dd - HH:mm} [%-p] %C{1}.%M(%F:%L)-:%m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = false
appender.rolling.type = RollingFile
appender.rolling.name = rolAppender2
appender.rolling.fileName = ${log-path}/log2.log
appender.rolling.filePattern = ${log-path}/$${date:yyyy-MM}/Log-%d{dd-MMM-yyyy}.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yyyy-MMM-dd - HH:mm} [%-p] %C{1}.%M(%F:%L)-:%m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = false
appender.rolling.type = RollingFile
appender.rolling.name = rolAppender3
appender.rolling.fileName = ${log-path}/log3.log
appender.rolling.filePattern = ${log-path}/$${date:yyyy-MM}/Log-%d{dd-MMM-yyyy}-log3.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yyyy-MMM-dd - HH:mm} [%-p] %C{1}.%M(%F:%L)-:%m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = false
appender.rolling.type = RollingFile
appender.rolling.name = rolAppender4
appender.rolling.fileName = ${log-path}/log4.log
appender.rolling.filePattern = ${log-path}/$${date:yyyy-MM}/Log-%d{dd-MMM-yyyy}-log4.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yyyy-MMM-dd - HH:mm} [%-p] %C{1}.%M(%F:%L)-:%m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = false
appender.rolling.type = RollingFile
appender.rolling.name = rolAppender5
appender.rolling.fileName = ${log-path}/log5.log
appender.rolling.filePattern = ${log-path}/$${date:yyyy-MM}/Log-%d{dd-MMM-yyyy}-log5.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yyyy-MMM-dd - HH:mm} [%-p] %C{1}.%M(%F:%L)-:%m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = false
appender.rolling.type = RollingFile
appender.rolling.name = rolAppender6
appender.rolling.fileName = ${log-path}/log6.log
appender.rolling.filePattern = ${log-path}/$${date:yyyy-MM}/Log-%d{dd-MMM-yyyy}-log6.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yyyy-MMM-dd - HH:mm} [%-p] %C{1}.%M(%F:%L)-:%m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = false
appender.rolling.type = RollingFile
appender.rolling.name = rolAppender7
appender.rolling.fileName = ${log-path}/log7.log
appender.rolling.filePattern = ${log-path}/$${date:yyyy-MM}/Log-%d{dd-MMM-yyyy}-log7.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yyyy-MMM-dd - HH:mm} [%-p] %C{1}.%M(%F:%L)-:%m%n
appender.rolling.policies.type=Policies
appender.rolling.policies.time.type=TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = false
appender.rolling.type = RollingFile
appender.rolling.name = rolAppender8
appender.rolling.fileName = ${log-path}/log8.log
appender.rolling.filePattern = {log-path}/$${date:yyyy-MM}/Log-%d{dd-MMM-yyyy}-log8.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yyyy-MMM-dd - HH:mm} [%-p] %C{1}.%M(%F:%L)-:%m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = false
loggers = rolling
logger.rolling.name = org.springframework
logger.rolling.level = fatal
logger.rolling.name = logger1
logger.rolling.level = info
logger.rolling.additivity = false
logger.rolling.appenderRef.rolling.ref = rolAppender1
logger.rolling.name = logger2
logger.rolling.level = info
logger.rolling.additivity = false
logger.rolling.appenderRef.rolling.ref = rolAppender2
logger.rolling.name = logger3
logger.rolling.level = info
logger.rlolling.additivity = false
logger.rolling.appenderRef.rolling.ref = rolAppender3
logger.rolling.name = logger4
logger.rolling.level = info
logger.rolling.additivity = false
logger.rolling.appenderRef.rolling.ref = rolAppender4
logger.rolling.name = logger5
logger.rolling.level = info
logger.rolling.additivity = false
logger.rolling.appenderRef.rolling.ref = rolAppender5
logger.rolling.name = logger6
logger.rolling.level = info
logger.rolling.additivity = false
logger.rolling.appenderRef.rolling.ref = rolAppender6
logger.rolling.name = logger7
logger.rolling.level = info
logger.rolling.additivity = false
logger.rolling.appenderRef.rolling.ref = rolAppender7
rootLogger.level = info
rootLogger.appenderRefs = f
rootLogger.appenderRef.f.ref = rolAppender8
您需要为所有的附加符使用不同的名称。就目前而言,它只是在滚动。应该是..
appenders = rolling, rolling1, rolling2, .. so on
appender.rolling.type = RollingFile
appender.rolling1.type = RollingFile
appender.rolling2.type = RollingFile
这里的rolling、rolling1、rolling2是不同日志的不同滚动附加符。
和相应的其他属性。我刚刚选择了一个属性'type'作为示例。
我正在编写一个将以编程方式创建log4j2配置的程序。我在log4j2.xml文件中有一个默认配置。基于列表中的某些数据类型,我必须为每种类型创建/复制log4j配置。配置是为这些类型复制的dailyrolling appender。创建记录器配置,根据数据类型将日志消息写入不同的文件。但每天的滚动并没有发生。 下面是基于数据类型生成log4j配置的代码。如果我需要更改为基于尺寸的滚动,也可以帮助
Im使用具有以下依赖关系的log4j2: 编辑:我尝试添加includeLocation=“true”,但结果仍然相同 谢谢
我有一个log4j2 json配置文件,但似乎无法在Appender部分中放置多个“file”附加符。我想做的是用日志语句记录两个两个文件:一个文件是用于info级别或更高级别的,而另一个文件是调试级别的。 }
据我所知,log4j2中的RollingFileAppender不会在指定的时间(比方说-在一小时结束时)回滚,而是在超过时间阈值后到达的第一个日志事件时回滚。 有没有一种方法可以触发一个事件,一方面会导致文件滚动,另一方面不会附加到日志中(或者会附加一些无关紧要的东西,比如空字符串)?
我正在使用log4j2和滚动appender文件。我想使用自定义布局,但它不能正常工作。 我在JBoss工作。我已将具有cusotmize布局的lib放在libs目录中,因此它位于类路径中。 在log4j2.xml,我已经把以下配置: 但是没有正确记录! 提前谢谢 贾米拉
问题内容: 是否可以在Spring Boot应用程序的application.yml中配置每日文件追加程序? 即filenamePattern:myfile。%d {yyyy-MM-dd-HH-mm-ss} .log 我的application.yml文件中有如下配置。 谢谢 问题答案: 在你只需按此处所述配置 即类似: