troubleshooting Question

log4j - multiple logs in one class

Avatar of allelopath
allelopath asked on
Java
12 Comments2 Solutions377 ViewsLast Modified:
I have a problem with multiple logs in one class.
The problem is that the logs are being written, but then when the program is done, the files are being erased (contain nothing). I can see the log files fill up as the program goes along, so I know stuff is being written.

     FileAppender appender1 = null;
     try {
       myAppender1 = new FileAppender("file1.log",false);
     } catch(Exception e) {}

     logger1.addAppender(appender1);
     logger1.setLevel((Level) Level.INFO);
     
     FileAppender appender2 = null;
     try {
       myAppender2 = new FileAppender("file2.log",false);
     } catch(Exception e) {}

     logger2.addAppender(appender2);
     logger2.setLevel((Level) Level.INFO);
     
ASKER CERTIFIED SOLUTION
Mick Barry
Java Developer
Join our community to see this answer!
Unlock 2 Answers and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros