动态生成日志, 日志路径:
log4j2.xml 配置如下:
<?xml version="1.0" encoding="UTF-8"?> <Configuration> <Appenders> <File name="Log4jFile" append="true" fileName="logs/${date:yyyy-MM}/${date:yyyy-MM-dd}-log.log" bufferedIO="true" bufferSize="512"> <PatternLayout> <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p %c [%t] %m%n</Pattern> </PatternLayout> </File> </Appenders> <Loggers> <Root level="debug"> <AppenderRef ref="Log4jFile"/> </Root> </Loggers> </Configuration>
时间: 2024-11-08 19:14:19