logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 19597] New: - Enhancement: KeyFileAppender
Date Fri, 02 May 2003 15:23:33 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19597>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19597

Enhancement: KeyFileAppender

           Summary: Enhancement: KeyFileAppender
           Product: Log4j
           Version: 1.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Appender
        AssignedTo: log4j-dev@jakarta.apache.org
        ReportedBy: shapira@mpi.com


In response to requests on log4j-user list, I wrote this extension to 
FileAppender.  It takes one additional parameter, the contextKey.  It looks for 
the value of this parameter in the MDC of the logging event.  If the parameter 
is null (or not present), this appender writes to the normal file, i.e the one 
specified by the File attribute of File appender.  If the parameter is present, 
the appender writes to a different file, with the same name as the main file + 
the MDC value toString() as the file name.  

So this appender can potentially be writing to many files.  It tries to close 
them all gracefully in the closeFile() method.  The files are kept in a hashmap 
to ensure good performance, and aren't opened until needed to ensure no 
unnecessary handles are created.  This means the first logging call with a 
particular value for the MDC key will incur a file creation performance 
overhead.

First version, needs testing.  Also needs Jalopy-fying (or whatever formatting 
tool we're using).

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org


Mime
View raw message