Hi! We have been using log4j in the Java arena for some time, and are glad
someone is finally taking on the perl port... we had been using
Log::Dispatch::Config until now, but it didn't do categories. We appreciate
the effort!
I do have a couple of suggestions though:
1. Would it be possible to pass other objects to init() other than a
filename or a reference to a string literal? This would allow for
initialization of the log at runtime. We have a program that forks
processes from a perl-based daemon, and each of the processes will write to
its own log. Passing it a hash reference (or even better, an AppConfig
object) would enable us to do that fairly easily. I have included a
modified Config.pm that parses key/value pairs in a hash reference into the
@text array, but did not do an AppConfig one in case you had any issues with
relying on other Perl modules.
2. We will be using a wrapper class to wrap log4perl so that if log4perl
(or log4j) changes, we only need to change the one class instead of
everywhere it is referenced (we do this with log4j in Java as well). The
problem there is that the %F and %L parameters in PatternLayout no longer
report the correct file and line (they always report the wrapper class).
To solve that, I borrowed a solution from Log::Dispatch::Config: I made
$caller_level a package-level variable inside of Log::Log4perl::Appender
(instead of always passing 3 to the render() function), and I increment it
by one when my wrapper class is initialized. This gets the proper values
for the filename and line number. I have included the modified Appender.pm
as well (both are based off of version 0.21).
Feel free to modify the patches I made in case they don't flow right... let
me know if I can be of any help!
Thanks,
# Chris
______________________________________________________________________
Chris Donnelly cdo...@dm...
Software Systems Architect
Digital Motorworks
Austin, TX (512) 692-1101
|