You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Chris Berry <ch...@gmail.com> on 2005/09/15 16:20:44 UTC

Configuring log4j hierarchially, on-the-fly

I apologize if I have posed this twice. I do not see my post in teh
archives, nor did I recieve a copy (although that could be a gmail
thing)

Greetings,
I'm pretty certain that I know that answer to my question before I ask
(It's not possible ;-) -- but I'll ask anyway, just in case I'm
missing something

I would like to set up the following;
I have a base set of reusable utilities, including a logging setup
based on log4j, which does things like setup custom Layouts, etc.
Let's call this my-utils. It configures common stuff like the
rootLogger, base-level loggers which categorically partition "the
logging space"  (e.g. DBGLOG, ERRLOG, PERFLOG, ...), etc. Stuff we
want to standardize across apps.

I have many apps which include my-utils. These apps would like to
augment the logging setup, by say adding their own Loggers and/or
Appenders.

I know that one cannot remove Loggers -- that's fine. And I know that
one can add Loggers and Appenders programatically (so I have this as a
fallback)

And, AFAIK, it is not possible to reconfigure a Configurator without
losing the current references?? Thus, if you do this, any currently
defined Loggers will get the dreaded "trying to write to a closed
Appender" message. Right??

But what I would like to do is; allow the apps to add Appenders and/or
Loggers using the same XML as that used by log4j -- say, through a
simple programmatic interface like; addAdditionalLogging( "myfile.xml"
). This way I'm not reinventing the wheel, I get the full power of
log4j, and I can simply point users at the log4j docs.

Is this possible?? Are there any pieces of log4j that I might use to
accomplish this??

Thanks much,
-- Chris

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