← Back to team overview

randgen team mailing list archive

Re: [Bug 1108572] Re: No text from say() or print() within ErrorLogAlarm makes it to the trial/runall log.

 

On 01/29/2013 10:35 AM, RoelV wrote:
John, so, I used your testcase on MySQL 5.5.29 and still had the same
issue.

As a test, I installed Log4Perl (sudo perl -MCPAN -e'install
Log::Log4perl') and the error log now contained all the correct
information strings.

To make sure, I uninstall Log4Perl (sudo perl -MCPAN -e 'install
App::pmuninstall' ; sudo /usr/local/bin/pm-uninstall Log::Log4perl) and
re-checked: all info was gone from the log as per the original
description.

So, there is some interaction issue with Log4Perl it seems. Bernt may be
able to help?
Strange. The code looks like this:

sub say {
    my $text = shift;
    defaultLogging();
    if ($text =~ m{[\r\n]}sio) {
        foreach my $line (split (m{[\r\n]}, $text)) {
            if (defined $logger) {
                $logger->info($line);
            } else {
                print "# ".isoTimestamp()." $line\n";
            }
        }
    } else {
        if (defined $logger) {
            $logger->info($text);
        } else {
            print "# ".isoTimestamp()." $text\n";
        }
    }
}

and defaultLogging is defined like this:

And $logger is defined like this:
my $logger;
eval
{
    require Log::Log4perl;
    Log::Log4perl->import();
    $logger = Log::Log4perl->get_logger('randgen.gentest');
};

defqaultLogging just does some initialization if $logger is defined. Can't see why say() should do somethingelse when $logger is defined compared to $logger being undefined.

That said: perl libraries are not thread safe. It is known that e.g. print/printf is not thread safe, so there might be some issue there which is out of our control (unless we rewrite RQG to some proper modern language instead of using a hacker language originating some decades back in the previous millenium).


Can you re-check on your end with uninstall of log4Perl?

Ftm, I have already updated the RQG manual with this new [workaround?] requirement:
https://github.com/RQG/RQG-Documentation/wiki/RandomQueryGeneratorQuickStart#wiki-43_LogLog4perl_module_required_for_properly_printing_things_for_example_in_ErrorLogAlarm



References