My Java project contains following packages - com.main.log4j.main , com.main.log4j.other.
I want log lines of package "com.main.log4j.other" to be removed from Console log, rather maintain a different log file for the same package. I am using Log4j version 1.2.16, with following log4j.xml config.
<appender name="CONSOLE-LOG" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="..." />
</layout>
</appender>
<appender name="OTHER-LOG" class="org.apache.log4j.FileAppender">
<param name="File" value="logs/Others.log" />
<param name="Threshold" value="DEBUG" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="..." />
</layout>
</appender>
<category name="com.main.log4j.other">
<appender-ref ref="OTHER-LOG" />
</category>
<root>
<level value="debug" />
<appender-ref ref="CONSOLE-LOG" />
</root>
Using this config, a separate log file Others.log is created with log line, but those log lines are still present in console log. I want to exclude them. Please suggest me how I can configure the log4j.xml?