> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Robert Hicks
> Sent: Tuesday, 14 November 2006 9:13 a.m.
> To: cgiapp@lists.erlbaum.net
> Subject: [cgiapp] Re: Anyone using Log4perl?
> 
> Dan Horne wrote:
> >> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Robert Hicks
> >> Sent: Tuesday, 14 November 2006 8:38 a.m.
> >> To: cgiapp@lists.erlbaum.net
> >> Subject: [cgiapp] Anyone using Log4perl?
> >>
> >> I was wondering if anyone is either working on a Log4perl 
> plugin or 
> >> is currently using it in CA with a simple pre-run wrapper.
> >>
> > 
> > You could try something like in your base class:
> > 
> > sub logger {
> >     my $self = shift;
> >     unless ($self->{__MYAPP_LOGGER}) {
> >         
> Log::Log4perl::init_and_watch($self->conf->param('cms_logger_conf'),
> >             30);
> >         $self->{__MYAPP_LOGGER} = get_logger("cms");
> >     }
> >     return $self->{__MYAPP_LOGGER};
> > }
> > 
> > 
> > And then test with something like this in your code:
> > 
> > $self->logger->debug('Test message');
> > 
> > Dan
> > 
> 
> When you say "base class" I assume you mean (or think) I am 
> creating a plugin? I was hoping to just use it and make it 
> more CA like. I guess I could try my hand at a plugin for it.
> 
> Robert
> 

Sorry - that's a bit confusing. I have a standard class that inherits from
CGI::App and includes logging, db connection setup, authentication etc. My
run-mode classes simply sub-class this.

If you sub-class CGI::App directly, then stick the logger method above in
your regular classes. You don't need to create a plugin.

Dan


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to