• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Log4j Problem

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic