You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Don Seiler <do...@seiler.us> on 2005/09/30 23:05:11 UTC
commons-logging to dynamically-named files?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hullo.
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.
- --
Don Seiler
don@seiler.us
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xFC87F041
Fingerprint: 0B56 50D5 E91E 4D4C 83B7 207C 76AC 5DA2 FC87 F041
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDPaiHdqxdovyH8EERAlj9AJ9/k2tbIZzH8LFMwp8XOBwSgjwY3QCfRR9q
vaEWVpLUCnVmeUBpUBaIvSU=
=wRRb
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: commons-logging to dynamically-named files?
Posted by Simon Kitching <sk...@apache.org>.
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.
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org