[Xml-compile] Logging from callback

Mark Overmeer mark at overmeer.net
Fri Apr 23 08:49:13 GMT 2010


* Robin V. (robinsp at gmail.com) [100422 23:20]:
> > Complex?  The use of Log::Report is rather simple. The problem is
> > that you mix two logging frameworks within one program.
> 
> In fact, I'm not a perl guru

You'll become one soon ;-)

>                                                I didn't want to mix
> frameworks, but as I started to use log4perl in my project, I didn't
> expect to have to change logging tool because of a module I use.

Bigger libraries need some exception handling facilities, and Perl
does not offer een standard system... so there are at least five of
them. This is certainly problematic. Log::Report is able to pass
reports to two of the other, to enable integration.

> In fact, I didn't really need log4perl. I could have used Log::Report
> from the beginning so the dispatcher doesn't really matter to me.

Not important for you, but certainly important for libraries you use.
Those are also part of your application.

> For some unknown reason, I didn't managed to see anything from the
> 'PERL' backend where logs outside the callback were working, but not
> the logs from the callback itself. With the 'FILE' backend, I managed
> to write logs, but the file writing was buffered until closing which
> was useless for debugging puropse.

Ok, that's an omission. Log/Report/Dispatcher/File.pm

        my $binmode = $args->{replace} ? '>' : '>>';

        $self->{output} = IO::File->new($to, $binmode)
            or fault __x"cannot write log into {file} with {binmode}"
                   , binmode => $binmode, file => $to;
 +      $self->{output}->autoflush;

I will also extend the docs about that a little.
-- 
Regards,
               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list