[logback-user] RollingFileAppender that splits logs into files/directories by logger name

Eric Faden eric at techeminence.com
Thu Sep 18 15:55:22 CEST 2008


I am building a RollingFileAppender to split the logs into 
directories/files based on the logger name.  The goal is to have a 
single Appender "A" that takes in a bunch of loggers and spits the logs 
out into separate RollingFileAppenders based on the logger name.  
Basically my plan is to have an Appender that contains a HashMap of 
LoggerName (String) to RollingFileAppender.  When I see a name for the 
first time I create a RollingFileAppender for it and place it into the 
HashSet.  My problem is that there is going to be a single 
RollingPolicy/Triggering Policy for "A" which needs to get duplicated to 
the subappenders.  The issue with this is that I can't use the same 
object since i need to modify the filepattern to have the correct file 
names on it.  The problem with that is that the object isn't cloneable.  
Can anyone think of a good way to handle this?  Or am I going about this 
all wrong?

-Eric


More information about the Logback-user mailing list