posted 22 years ago
Hi All,
I am trying this out :
I have built a wrapper class around Log4j.Now I want to log through the methods of these wrapper classes.
I want to log in 2 different log files .
Some msgs need to be logged in 1 file and some in the other.
But the problem is what should I specify in configuration file for Log4j.
I am specifying this:
***********************************************
<appender name="A1" class="org.apache.log4j.FileAppender">
<param name="File" value="D:/bea/user_projects/CheckFreeDomain/applications/CheckFree/logs/SimpleLog.log" />
<param name="Append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{DATE} %-6r %-5p %30.30c %x - %m\n" />
</layout>
</appender>
<category name="checkFree.MyApp">
<priority value="debug" />
<appender-ref ref="A1" />
</category>
<appender name="A2" class="org.apache.log4j.FileAppender">
<param name="File" value="D:/bea/user_projects/CheckFreeDomain/applications/CheckFree/logs/AuditTrail.log" />
<param name="Append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
</layout>
</appender>
<category name="checkFree.MyApp">
<priority value="debug" />
<appender-ref ref="A2" />
</category>
**********************************************
MyApp is the logger class.
But the problem is when I log messages it only writes to one of the log files and depends upon which wrapper class I am calling first.
why is that happening and its not logging in other file.
Can somebody point out where I am going wrong.
Sumeet.