This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Log4j Problem

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • 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.
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!