我有如下所示的 log4jConfig.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="false" xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="abcLog4j" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/myapp/app/myserver/myproj/domains/logs/abcLog.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="5000KB"/>
<param name="MaxBackupIndex" value="5"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
</layout>
</appender>
<logger name="com.mywhole.mysub.abc" additivity="false">
<level value="INFO"/>
<appender-ref ref="abcLog4j"/>
</logger>
<appender name="xyzLog4j" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/myapp/app/myserver/myproj/domains/logs/xyzLog.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="5000KB"/>
<param name="MaxBackupIndex" value="5"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
</layout>
</appender>
<logger name="com.mywhole.mysub.xyz" additivity="false">
<level value="INFO"/>
<appender-ref ref="xyzLog4j"/>
</logger>
<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
</layout>
</appender>
.......................
<root>
<priority value="ERROR"/>
<appender-ref ref="sysoutLog4j"/>
</root>
</log4j:configuration>
我面临的问题是从 com.mywhole.mysub.xyz 中的类生成的日志语句将进入 abcLog.log,反之亦然。谁能解释我如何解决这个问题
package com.mywhole.mysub.xyz.model;
// import ....
public class MyBeackingBean extends MySuperBB{
public static final LoggerInterface log = LoggerFactory
.getLogger(MyBeackingBean.class);