Paul Glezen wrote:
> 
> > I think Syslog's configurations are more flexible. With Syslog, you
> > can modify a running configuration and ask it to write its
> > configuration out to an XML file to be read in later.
> 
> Cool.  I belive log4j's config mechanism is quite flexible.  One can
> also change it programmatically at runtime.  I don't believe log4j will
> write a property/xml file with the currently running configuration.  We
> might consider doing that some time if anyone wants to code it.  It
> would be a nice feature.

It's a done deal. Up to a point, anyway. Have a look at PropertyGetter
and PropertyPrinter in org.apache.log4j.config as well as
PrintProperties in the test package. The two former classes together
provide support for dumping the current log4j configuration to a
properties config file.

It cannot handle all aspects of config files, especially not some of the
more advanced features which are in the DOMConfigurator and not the
PropertyConfigurator. Also, there's currently no way of generating an
XML config file, only properties file.  I was planning on adding some of
those missing parts and then use them to write a small transcoding
utility which would translate between different config formats simply by
using one configurator to to configure log4j in teh usual manner and
then use a "config writer" for outputting the current log4j
configuration in a different format (or the same as a way to get
pretty-printing, maybe).

I was (am, when I find the time) going to use this feature as part of
way to have a console tool connect to a running JVM with log4j
configured. The console would connect, retrieve the current
configuration, set up a new hierarchy of its own with the configuration
retrieved from the other guy (possibly massaged somehow), and then have
other guy add a SocketAppender at select points in it's configuration
hierarchy. This would allow the console to receive logging data and
render it just like it's rendered by the "other guy". Sounds like fun,
no?

Cheers,
Anders

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to