Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Catalyst::Log::Log4perl branch

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


adam at stalecoffee

Mar 2, 2007, 11:26 AM

Post #1 of 4 (262 views)
Permalink
Catalyst::Log::Log4perl branch

Several people have pointed out that various parts of Log::Log4perl
don't work well with Catalyst. Specifically, many of the options
that rely on Stack information are incorrect. The format strings:

%L Line number within the file where the log statement was issued
%F File where the logging event occurred
%C Fully qualified package (or class) name of the caller
%M Method or function where the logging request was issued
%l Fully qualified name of the calling method followed by the callers
source the file name and line number between parentheses.

Sebastian Willert has helpfully provided a patch that should resolve
these issues. He rules. His changes have been put on this branch:

http://dev.catalyst.perl.org/repos/Catalyst/branches/Catalyst-Log-
Log4perl/cspec-fixes

I'm going to be pretty busy for the next few days, but don't want to
sit on this any longer. Can those of you using
Catalyst::Log::Log4perl give this a whirl, and make sure it works
with your applications? (And doesn't cause any kind of nasty
performance implications, especially with the cspec fixes disabled?)

Your rewards will be my enduring gratitude, and a better
Catalyst::Log::Log4perl.

Thanks!

Adam

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


mreece at vinq

Mar 2, 2007, 11:52 AM

Post #2 of 4 (231 views)
Permalink
Re: Catalyst::Log::Log4perl branch [In reply to]

this brings up an interesting difference in side-effects of
Catalyst::Log->error() and Log::Log4perl->error().

in the course of trying to integrate catalyst logging with other
existing Log4Perl loggers in the codebase, i had tried first setting
catalyst's logger to be the global logger,

$c->log($one_true_logger);

but ran into issues like those you are trying to solve.

so i tried an alternate approach,

$one_true_logger = $c->log;

but i have existing code that relies on the side-effect of
$log4perl_logger->error() [and friends] returning undef,

return $one_true_logger->error('oops'); # logs and returns false

but Catalyst::Log::_log ends with (and thus returns)

$self->{body} .= sprintf( "[%s] %s", $level, $message );

is there any reason not to patch Catalyst::Log::_log to 'return;'
after appending $self->{body}?

(or perhaps better in the method generation,

*{$name} = sub {
my $self = shift;

if ( $self->{level} & $level ) {
$self->_log( $name, @_ );
}
+ return;
};

so the false RV is reliable even if level is too low.



On Mar 2, 2007, at 11:26 AM, Adam Jacob wrote:

> Several people have pointed out that various parts of Log::Log4perl
> don't work well with Catalyst. Specifically, many of the options
> that rely on Stack information are incorrect. The format strings:
>
> %L Line number within the file where the log statement was issued
> %F File where the logging event occurred
> %C Fully qualified package (or class) name of the caller
> %M Method or function where the logging request was issued
> %l Fully qualified name of the calling method followed by the
> callers source the file name and line number between parentheses.
>
> Sebastian Willert has helpfully provided a patch that should
> resolve these issues. He rules. His changes have been put on this
> branch:
>
> http://dev.catalyst.perl.org/repos/Catalyst/branches/Catalyst-Log-
> Log4perl/cspec-fixes
>
> I'm going to be pretty busy for the next few days, but don't want
> to sit on this any longer. Can those of you using
> Catalyst::Log::Log4perl give this a whirl, and make sure it works
> with your applications? (And doesn't cause any kind of nasty
> performance implications, especially with the cspec fixes disabled?)
>
> Your rewards will be my enduring gratitude, and a better
> Catalyst::Log::Log4perl.
>
> Thanks!
>
> Adam
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/
> catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/



_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


jshirley at gmail

Mar 3, 2007, 1:32 PM

Post #3 of 4 (223 views)
Permalink
Re: Catalyst::Log::Log4perl branch [In reply to]

On 3/2/07, Adam Jacob <adam [at] stalecoffee> wrote:
> Several people have pointed out that various parts of Log::Log4perl
> don't work well with Catalyst. Specifically, many of the options
> that rely on Stack information are incorrect. The format strings:
>
> %L Line number within the file where the log statement was issued
> %F File where the logging event occurred
> %C Fully qualified package (or class) name of the caller
> %M Method or function where the logging request was issued
> %l Fully qualified name of the calling method followed by the callers
> source the file name and line number between parentheses.
>
> Sebastian Willert has helpfully provided a patch that should resolve
> these issues. He rules. His changes have been put on this branch:
>
> http://dev.catalyst.perl.org/repos/Catalyst/branches/Catalyst-Log-
> Log4perl/cspec-fixes
>
> I'm going to be pretty busy for the next few days, but don't want to
> sit on this any longer. Can those of you using
> Catalyst::Log::Log4perl give this a whirl, and make sure it works
> with your applications? (And doesn't cause any kind of nasty
> performance implications, especially with the cspec fixes disabled?)
>
> Your rewards will be my enduring gratitude, and a better
> Catalyst::Log::Log4perl.
>
> Thanks!
>
> Adam
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>

Hey Adam,

Thanks for doing the work here. I've got it going in one of my apps
on the dev site, things are working ok so far. I'll keep banging on
it and making sure that it continues to work a-ok. If you have
anything specific you'd like me to focus on just holler, otherwise
I'll be doing generalized testing.

Example from the log (pattern is:[%d %p (Method: %M; Class: %C; Line:
%L; FQN: %l] %m%n) :
[.2007/03/03 13:31:30 DEBUG (Method: Catalyst::View::TT::render; Class:
Catalyst::View::TT; Line: 453; FQN: Catalyst::View::TT::render
/usr/lib/perl5/site_perl/5.8.7/Catalyst/View/TT.pm (453)] Rendering
template "root.tt"


And, as an aside, It'd be great to have a _dump feature as well --
patches welcome?

Thanks,
-Jay
--
J. Shirley :: jshirley [at] gmail :: Killing two stones with one bird...
http://www.toeat.com - http://www.mailroller.com

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


adam at stalecoffee

Mar 5, 2007, 11:43 AM

Post #4 of 4 (223 views)
Permalink
Re: Catalyst::Log::Log4perl branch [In reply to]

On Mar 3, 2007, at 1:32 PM, J. Shirley wrote:
> Hey Adam,
>
> Thanks for doing the work here. I've got it going in one of my apps
> on the dev site, things are working ok so far. I'll keep banging on
> it and making sure that it continues to work a-ok. If you have
> anything specific you'd like me to focus on just holler, otherwise
> I'll be doing generalized testing.
>
> Example from the log (pattern is:[.%d %p (Method: %M; Class: %C; Line:
> %L; FQN: %l] %m%n) :
> [.2007/03/03 13:31:30 DEBUG (Method: Catalyst::View::TT::render; Class:
> Catalyst::View::TT; Line: 453; FQN: Catalyst::View::TT::render
> /usr/lib/perl5/site_perl/5.8.7/Catalyst/View/TT.pm (453)] Rendering
> template "root.tt"
>
>
> And, as an aside, It'd be great to have a _dump feature as well --
> patches welcome?

Very. Thanks for checking this out, Jay.

Adam


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.