logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: multi-user logger
Date Tue, 04 Dec 2007 22:21:54 GMT

On Dec 4, 2007, at 3:41 PM, Christoph Macheiner wrote:

> hi...
> i am currently trying to incorporate log4cxx into our multi-user
> software. basically it is working well, but there is demand for more
> extensive configuration (instead of our "fixed" configuration). the  
> wish
> is as follows: each user can work with different modules and/or
> different logins, and all users/modules are serviced by one single
> process (the single user/module per process scenario would of course  
> be
> no problem). assume, i want to use loggers named MODULE_NAME.USER_NAME
> that should be configured dynamically from a single configuration file
> (i use the domconfigurator).
> the problem is, for example, with file appenders. there can be  
> hundreds
> of user/module combinations, but they can be grouped into a few
> different loggers that need to be parametrized at runtime (like  
> filename
> should be MODULE_NAME.USER_NAME.log for one group, but only
> MODULE_NAME.log for others etc).
> the coolest thing would be to have the xml configuration file as a
> "template" and create all loggers at runtime from that template xml.
> then i could dynamically replace the filenames (etc) and/or reuse
> already configured loggers for users of the same group. i cannot  
> really
> "hard-configure" all the loggers in the configuration file because,  
> as i
> mentioned, there could possibly be hundreds of different files.
> so, is there a way to create all my loggers at runtime, from an xml
> document provided on the fly? or is there an easier solution...
> any help is greatly appreciated (and sorry for the long post). thanks
> very much, christoph.

There isn't anything in the current code base of log4cxx or log4j that  
would address that issue.  However, it does sound up the alley of the  
hypothetical log4j MultiFileAppender.  If you search the log4j-dev  
mailing list, you will see a lot of postings discussing such a beast.   
Some of the building blocks were sketched out in the log4j "sandbox",  
but didn't evolve to the point of a usable appender.  I've had good  
intentions to get back to developing it since issues that would  
benefit from it come up frequently, but I can develop less code than I  
can imagine and didn't get much feedback or assistance.

Basically, the idea is that an MFA could manage a constrained set of  
open file handles where the destination of a logging request would be  
based on an examination of the LoggingEvent.  An MFA could be used to  
put all messages from a specific thread, or of a specific level, or of  
a specific time frame, etc, into a specific file and would not need to  
close off other open files (which causes problems with the  
RollingFileAppender's since they close before open and can't recover  
if they can't open a new file).

In your scenario, the file name strategy for the MFA could examine the  
logging event and use the user name (which could be stored in the MDC)  
and the module name (extracted from the logger name?) to generate the  
file name and the MFA would be responsible for managing the files.

Once developed for log4j, it should be fairly simple to port to  
log4cxx.  However, there has been no activity on it for many, many  

View raw message