[Xml-compile] Logging from callback

Mark Overmeer mark at overmeer.net
Thu Apr 22 07:25:28 GMT 2010


* Robin V. (robinsp at gmail.com) [100421 22:40]:
> I'm fighting (again) with logging framework of xml::compile. The
> complexity of the Log::Report taking over other logging mechanisms is
> driving me crazy and after an hour of tries I think I need somebody
> help.

Complex?  The use of Log::Report is rather simple. The problem is
that you mix two logging frameworks within one program.

> Moose classes rely on log4perl in simple mode (
> Log::Log4perl->easy_init( $DEBUG ); ) and everything is fine (I can
> log from my object constructor). But if I try to log using
> ERROR("XXX") or DEBUG("XXX") from the callback, I can see nothing. I
> also tried simple print without any more results. I tried different
> things like, dispatcher PERL => 'usual',  mode => 'DEBUG'; without
> success.

With Log::Report, you have exception generators, like error() and
exception handlers: dispatchers.  You can dispatch to Log::Log4perl.

  use Log::Report;

  dispatcher Log::Log4perl => 'l4p', accept => 'NOTICE-'
    , config => "$ENV{HOME}/.log.conf";

See Log::Report::Dispatcher::Log4perl
The module does call    Log::Log4perl->init($config);
which may be inconvenient because probably Moose will do that as well.
So if you have suggestions for interface extension, then feel invited.
-- 
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