Hello Log4perl Developers, I noticed that logcroak (die,confess...) always die()s with a stringified version of what you pass to it.
Here's an example: --- #!/usr/bin/env perl package Status; use Moose; use Log::Log4perl qw(:easy); Log::Log4perl->easy_init($ERROR); use Carp; use overload q{""} => sub { $_[0]->as_string }, fallback => 1; has 'logger' => ( is => 'ro', isa => 'Log::Log4perl::Logger', lazy => 1, default => sub { return( Log::Log4perl->get_logger('Status') ); }, ); has code => ( is => 'ro', isa => 'Int', required => 1 ); has message => ( is => 'ro', isa => 'Str', required => 1 ); sub as_string { my ($self) = @_; return ( sprintf( 'Status: %s (%s)', $self->message, $self->code ) ); } sub throw { my $self = shift; croak($self); } sub throw_log4perl { my $self = shift; $self->logger->logcroak($self); } package main; use Data::Dumper; my $s = Status->new( code => 500, message => 'Foobar'); eval { $s->throw }; print Dumper($@); eval { $s->throw_log4perl }; print Dumper($@); --- END --- Output: $VAR1 = bless( { 'message' => 'Foobar', 'code' => 500 }, 'Status' ); 2012/10/15 12:19:41 ESB Error: Foobar (500) at log4perl-test.pl line 50 $VAR1 = 'ESB Error: Foobar (500) at log4perl-test.pl line 50 '; --- Shouldn't logcroak log a stringified version and call croak on the value you passed to it instead of calling croak on the log message? The docs say: "Finally, there's the Carp functions that do just what the Carp functions do, but with logging:" Regards, Markus Benning ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel