1
我有一個Web應用程序(使用Maven創建)2.1
log4j的配置文件下:春4.2.5無法查看日誌與Spring 4.2.5和log4j消息
/proj/src/main/resources/log4j2.xml
好像log4j的是設置正確,我能看到的日誌從我的課罰款(com.my.project.classes)
當我用我的班log4j的日誌如:
private static Logger logger = LogManager.getLogger(MyController.class);
問題是我無法看到來自org.springframework的日誌消息,
我看到文件和目錄都創建了C:/tmp/log2/Log.html和C:/tmp/log1/Log.html
但是隻有C:/tmp/log1/Log.html將有消息 - 其他日誌/ html文件將保持爲空
我做錯了什麼?
這是我log4j2.xml:
<Property name="fileName">C:/tmp/log1/Log.html</Property>
<Property name="fileName2">C:/tmp/log2/Log.html</Property>
...
<RollingFile name="MyRollingFile" fileName="${fileName}" filePattern="${fileNamePattern}">
<HTMLLayout charset="UTF-8" pattern="${logPattern}"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="10MB"/>
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
<RollingFile name="MyRollingFile2" fileName="${fileName2}" filePattern="${fileNamePattern}">
<HTMLLayout charset="UTF-8" pattern="${logPattern}"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="10MB"/>
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
<Logger name="com.my.project.classes" level="debug" additivity="false">
<AppenderRef ref="MyRollingFile"/>
</Logger>
<Logger name="org.springframework" level="debug" additivity="false">
<AppenderRef ref="MyRollingFile2"/>
</Logger>
好像它沒有任何區別。 – user648026