[Koha-devel] [RFC] Using Log4perl to extend and improve logging and debugging
Jean Pieerre Ducassou
ducassou at ort.edu.uy
Wed Sep 24 18:31:25 CEST 2008
Frederic Demians escribió:
> Thanks Andrew. I've tried out your patch. As a proof of concept, it
> works for me! I was pleasantly surprised by how easy it has been
> to test your patch thanks to git...
>
> The question is: how your logging mechanism will play with current Koha
> logging systems: warning in code and C4/Log.pm? I'd suggest:
>
> * user log: keep C4/Log.pm for logging Koha users activities
> * system log: Log4perl for debugging and support
>
> My testing notes:
>
> log4perl.conf configuration file
>
> It should rather be placed in a configuration directory than in Koha
> install root directory.
>
> Installation process
>
> Koha installation process will have to take care of a default logging
> schema, installing :
>
> * log4perl.conf in the appropriate directory, with other conf files
> (obviously)
> * various log files in the log directory which depend on installation
> type: dev, standard (with correct right: 0666)
>
> Repetitions
>
> Log messages seem to be repeated in several log files using your
> log4perl.conf file. For example, doing a search in OPAC
> create 3 log messages:
>
> - 2 in koha-opac.log
> - 1 in koha.log
>
> --
> Frédéric
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha.org
> http://lists.koha.org/mailman/listinfo/koha-devel
>
I being using Log4perl for some time. It's really cool indeed.
I think the best way to patch the system is import it in C4::Context
like this:
use Log::Log4perl;
Log::Log4perl -> init_once($conf_log_fname);
Then all the other modules just have to do:
use Log::Log4perl;
my $logger = Log::Log4perl -> getlogger();
It's magical!
Furthermore, the configuration could be loaded from the main config file.
As for the repetitions, it's just a matter of configuring it properly
I'm sure.
May be Koha should use a whole framework (like CGI::Application). It
would be easier to mantain and far more powerful.
Kind regards,
JP.
More information about the Koha-devel
mailing list