[Koha-devel] RFC: Koha needs a logger!

Kyle Hall kyle.m.hall at gmail.com
Fri Sep 14 16:09:25 CEST 2012


Hey all,

I've been thinking about this for quite a while now. I feel that Koha
would benefit greatly from having a traditional logger, rather than
relying on warn's being written to the apache logs. This would give us
many benefits. First, we would be able to log everything to one or
more standard files, regardless of whether that file was running under
apache or not. Second, we could implement standard logging levels (
trace, debug, info, warn, error, fatal ). It would also help us debug
ajax-related issues where child processes no longer write to the
apache module.

The Catalyst Perl framework has been a primary inspiration for this.
We could have C4::Context->log->debug('this is a test message'); Our
logger would detect the current error level and output or ignore the
message accordingly.

My research has lead me to Log4perl, which seems to be an outstanding
logging module. It can even capture existing warns and dies. It would
work perfectly except for one scenario I was hoping for.

I have been thinking it might be useful for developers and even just
experienced Koha users of the we could dump all the log output to the
webpage. So mainpage.pl?debug=1 would not only enable debug messages,
but then append all those debug messages to the bottom of the returned
html. Log4perl is meant to be used as a singleton, so even if we can
get the logged message back out, it would have messages from other
koha scripts that were running concertedly. If I am incorrect, please
let me know!

So the options are:
1) Forget about the dump-to-screen feature, and just use Log4perl
2) Write our own logger from scratch with all these features, largely
duplicating the effor of Log4perl and other loggers
3) Write our own logger that can handle the dump-to-screen feature,
but use Log4perl within Koha::Logger for all other logging.

Another idea, implement dbi tracing to allow dumping of all queries to
the screen and log. Also, Perhaps the dump-to-screen could create a
popup window instead of appending to the bottom of the screen.

I'm looking for any and all opinions or ideas on this subject.

Thanks!
Kyle

http://www.kylehall.info
ByWater Solutions ( http://bywatersolutions.com )
Meadville Public Library ( http://www.meadvillelibrary.org )
Crawford County Federated Library System ( http://www.ccfls.org )
Mill Run Technology Solutions ( http://millruntech.com )


More information about the Koha-devel mailing list