On Tue, 6 Nov 2007, Jonathan Swartz wrote:

> >> Right, I expected that new categories would keep cropping up. Why
> >> would it be a problem for an appender to open new filehandles on
> >> the fly? Other than worrying about maximum # of filehandles?
> >
> > Categories are added at init() time, not at log() time. If you add
> > a new
> > category to Log4perl, you have to run init().
>
> Huh? I can add a category at runtime like
>      my $log = Log::Log4perl->get_logger('foo.bar.baz');
> without having declared foo.bar.baz at init() time.

Ah, I see, we're talking about different things. I was talking about
adding categories and associate appenders with them. You're adding
them to the hierarchy and rely on category inheritance.

> I think you mean that categories are associated with appenders at init
> () time, right? But I'm not looking to create a ton of different
> appenders. I'm looking to create a single appender that handles all
> categories, and automatically writes to the right filename based on
> the category passed to log().

So you want a custom appender that dynamically changes the file it's
writing to. Since the appender's log() function gets 'log4p_category' in
its %param hash, this should be straight-forward to implement.

Sounds like an interesting idea, I'm looking forward to it!

-- Mike

Mike Schilli
[EMAIL PROTECTED]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to