commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: commons-logging to dynamically-named files?
Date Sat, 01 Oct 2005 00:28:11 GMT
On Fri, 2005-09-30 at 16:05 -0500, Don Seiler wrote:

> Playing with commons-logging today.  Seems to do what I'll need although
> I would like to be able to determine the file handler/appender name at
> runtime.  Most often in my case, the logfile name is partially based on
> date/time, e.g. "blah_20050930160200.log".
> The user's guide only mentions setting the file name as a property in a
> properties file.  I tried setting the property in (taking a guess) the
> System properties but it seems that the file is loaded into a special
> Log props object.
> None of my google/list archive searches have turned up anything useful.
>  If anyone has any hints or examples it would be much appreciated.

Remember that commons-logging is just a *minimal* *portable* wrapper
around various real logging libraries. This makes it possible to write
libraries (like the other commons projects) which log messages without
assuming any particular real logging implementation.

Commons-logging explicitly does *not* manage logging library startup,
shutdown and configuration. As it happens, most logging libraries are
capable of initialising themselves when first used, so applications
using commons-logging can get away with skipping all explicit logging
lib initialisation in many cases.

For convenience, commons-logging includes a trivial "SimpleLog" logging
implementation. It really is meant only as a last resort, and isn't
intended to be performant or configurable.

So to answer your question: you need to handle this by configuring
whatever underlying logging library you're using commons-logging with.
If log4j, then check the log4j documentation.

If you're using the built-in SimpleLog then I doubt it supports the kind
of thing you want. However you could write your own logging
implementation based on SimpleLog if you want; should only be one class.
But for any *real-world* application you probably want a proper logging
library such as log4j anyway.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message