
Is it possible to configure xml file in such a way that it has different logging levels for diferent packages in java through Log4J ?

<--configure path according to your requrmts to save log file -->
<appender name="daoAppender"
class="org.apache.log4j.RollingFileAppender">
<param name="maxFileSize" value="100KB" />
<param name="maxBackupIndex" value="2" />
<param name="File" value="${jboss.server.home.dir}/deploy/myexampleprj.war/serverlogs/serverlogs.txt" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{dd-MMM-yyyy HH:mm};%5p %c %m%n" />
</layout>
</appender>
<--configure path according for diff packge to your requrmts to save log file -->
<!--appender name="appAppender"
class="org.apache.log4j.RollingFileAppender">
<param name="maxFileSize" value="100KB" />
<param name="maxBackupIndex" value="2" />
<param name="File" value="${jboss.server.home.dir}/deploy/myexampleprj.war/serverlogs/serverlogs.txt" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ABSOLUTE} %5p %c{1}: %m%n " />
</layout>
</appender-->
<!â??package name given in category here com is the package give package name -->
<!--category name="com.ex.actions">
<priority value="DEBUG"/>
<appender-ref ref="appAppender"/>
</category-->
<category name="com">
<priority value="DEBUG"/>
<appender-ref ref="daoAppender"/>
</category>
<root>
<!--
<appender-ref ref="appAppender" />
<appender-ref ref="daoAppender" />
-->
</root>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.