log4j2.xml中该文件的等效log4j.properties文件是什么:
log4j.rootLogger=INFO, DEF
log4j.appender.DEF=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DEF.File=${catalina.home}/webapps/myApp/logs/hasan.log
log4j.appender.DEF.DatePattern='.'dd-MM-yyyy
# layout-config fro root-logger
log4j.appender.DEF.layout=org.apache.log4j.PatternLayout
log4j.appender.DEF.layout.ConversionPattern=%d{ISO8601} UTC [%25.25t] %-5p %25.25c %x - %m%n
答案 0 :(得分:1)
这是您的等效 log4j2.xml
width: 100%
答案 1 :(得分:0)
您可以尝试此log4j2.xml文件配置
<Configuration status="warn">
<Properties>
<Property name="basePath">logs/</Property>
</Properties>
<Appenders>
<RollingFile name="fileLogger" fileName="${basePath}/hasan.log"
filePattern="${basePath}/reporting-%d{yyyy-MM-dd}.log">
<PatternLayout>
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%t] [%-5level] %c{1}:%L - %msg%n
</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1"
modulate="true" />
</Policies>
</RollingFile>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout
pattern="%d{yyyy-MM-dd HH:mm:ss} [%t] [%-5level] %c{1}:%L - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Root level="info" additivity="false">
<appender-ref ref="console" />
</Root>
</Loggers>