Hi Simon, thanks for the bug report:

http://bugzilla.mkgnu.net/show_bug.cgi?id=1341

Something doesn't sound right here.

Glue.pm:process() sets up logging before Glue.pm:check_configuration is
called (which would lead to the problems you mention about 'auto' and
CVS/Git).

On Thu, 2009-03-12 at 11:49 +0000, Simon Brooke wrote:
> Further to this, the problem arises because Glue.pm scans its configuration 
> /before/ setting up the logger - and, indeed, must do so, because the logging 
> configuration is in the config file. However, it sets up a 'lightweight' 
> logger to handle the case that the configuration can't be logged. We can use 
> the same trick in log_fatal_error():

This is not true. Glue.pm scans its configuration /after/ setting up the
logger.

Perhaps the error is that the logger configuration was incorrect, and
logger initialization failed, which, if it is the case, should be
handled in Glue.pm:process() instead.

> s...@apu:~/Projects/CVSROOT$ diff /usr/share/scmbug/lib/Scmbug/Common.pm  
> lib/scmbug/Scmbug/Common.pm
> 219a220,226
> >     if ( ! $logger) {
> >     # sb 20090312: if no logger yet exists, set up a minimal one
> >             use Log::Log4perl qw(:easy);
> >             Log::Log4perl::easy_init( $WARN );
> >             $logger = get_logger( "Glue" );
> >     }
> >
> 
> This replaces my earlier suggestion and is probably better.
> 
> 
> -----Original Message-----
> 
> From: [email protected] on behalf of Simon Brooke
> Sent: Thu 12/03/2009 10:31
> To: [email protected]
> Subject: [scmbug-users] Logger being called before initialised and 
> partialsolution (version 0.26.13)
>  
> When Glue.pm checks whether to autodetect product names, it calls 
> log_fatal_error() if the policy is set to 'auto' and the SCM is CVS or Git. 
> However, at this stage the logger has not been initialised and you get the 
> error:
> 
> Can't call method "error" on an undefined value at 
> /var/lib/cvs/CVSROOT/lib/scmbug/Scmbug/Common.pm line 221.
> 
> This is fairly unhelpful, as the actual error message gets lost. Obviously 
> the correct solution would be to ensure that the logger gets initialised 
> before it is called, but in the meantime I've implemented a partial 
> workaround:
> 
> s...@apu:~/Projects/CVSROOT$ diff /usr/share/scmbug/lib/Scmbug/Common.pm  
> lib/scmbug/Scmbug/Common.pm
> 220,223c220,226
> <     $Log::Log4perl::caller_depth++;
> <     $logger->error( $error_string );
> <     $Log::Log4perl::caller_depth--;
> < 
> ---
> >     if ( $logger) {
> >             $Log::Log4perl::caller_depth++;
> >             $logger->error( $error_string );
> >             $Log::Log4perl::caller_depth--;
> >     } else {
> >     print STDERR $error_string;
> >     }
> 
> This is inelegant but it works.
> 
> 
> 
> Simon Brooke, Software Specialist
> Cygnet Solutions Ltd
> Registered office: Swan House, Darvel, Ayrshire, Scotland, KA17 0LP
> Registered in Scotland No. SC158059
> mail: [email protected]
> www: http://www.cygnets.co.uk
> tel: +44(0)1560 323444
> fax: +44(0)1560 323432
> 
> _______________________________________________
> scmbug-users mailing list
> [email protected]
> http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users
> 
> Simon Brooke, Software Specialist
> Cygnet Solutions Ltd
> Registered office: Swan House, Darvel, Ayrshire, Scotland, KA17 0LP
> Registered in Scotland No. SC158059
> mail: [email protected]
> www: http://www.cygnets.co.uk
> tel: +44(0)1560 323444
> fax: +44(0)1560 323432
> 
> _______________________________________________
> scmbug-users mailing list
> [email protected]
> http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
scmbug-users mailing list
[email protected]
http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users

Reply via email to