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 "Gould, Rick" <RG...@Airbiquity.com> on 2002/07/20 21:48:51 UTC

How to clone an Appender?

How would one clone an appender, since an override of Object.clone() is not
available?

Or, perhaps there's another way to do what I want:

I want to be able to create a series of Loggers at runtime, one per "line",
with associated FileAppenders, like:

line1.log
line2.log
line3.log
etc.

I want to have a single appender definition in a properties file which is
used as a template for defining the FileAppenders for these new Loggers.

My current approach is to have a single FileAppender definition (max size,
number of backups, pattern layout) in a properties file, and then at runtime
clone the appender, override the file name, and add it to my new line
Logger.  However, there is no clone method.  So, it seems like I must detect
if my template is a RollingFileAppender or DailyRollingFileAppender, then
create a new one, using the parameters from the template.

Any other ideas?

(p.s. - I tried to seach the archives, but the search page at
http://www.mail-archive.com/log4j-user@jakarta.apache.org/ only went back to
the beginning of July.  Anyway to search the entire archive???)

Thanks very much,

---
Rick Gould
Software Design Engineer
Airbiquity Inc.
rgould@airbiquity.com
206-219-2831 (direct)
206-910-9910 (mobile)
206-842-9262 (main office)



Auto-appended Corporate gobbledygook follows...  

This email is intended solely for the person or entity to which it is
addressed and may contain confidential or privileged information.  Any
review, dissemination, copying, printing or other use of this email by
parties or entities other than the addressee is prohibited.  If you have
received this e-mail in error, please contact the sender immediately and
delete the material from any computer.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>