File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes log4j problem: Multiple RollingFileAppender in an application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j problem: Multiple RollingFileAppender in an application" Watch "log4j problem: Multiple RollingFileAppender in an application" New topic
Author

log4j problem: Multiple RollingFileAppender in an application

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

Hi guys,

I'm using three log4j RollingFileAppenders in my application and only the one which I declare last works others don't roll the file. Has anyone faced the same issue? If this is a known problem then is there a solution (there are no matching hits on google). Here's my log4j.xml (I've changed some of the names as per my company's NDA)


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

Presumably you're rolling based on filesize, since you don't have a time-based policy in effect. So of course, if the logs stay under the threshold, they won't roll even if everything else is perfect.

Here's one of about 7 appenders I have in one app:



Customer surveys are for companies who didn't pay proper attention to begin with.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

Sorry I messed up with my words. The file actually rolls after the 20MB limit but the old logs don't get stored in a different file name i.e. the backup is not working...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: log4j problem: Multiple RollingFileAppender in an application
 
Similar Threads
Capture logs to file via log4j.xml
How Can I log my pintStackTrace () statement into log file?
Log4j doesn't split the log files as it supposed to
Getting log4j to write to multiple log files
how to disable the log