Aug 22, 2011, 12:56 AM
Post #3 of 4
I think the correct solution depends on to what extent test1.pl and test2.pl should keep their possibility to be "independent" on logging.
Re: [gdan2000] using global variable across "required" files
[In reply to]
If it is a "hard requirement" that they should use the same logger, having a logging module which is used by test1 and test2, is certainly the best solution. It can be Log4Perl, as Fishmonger has suggested, or it can be a module you write yourself. I personally use Log4Perl and am quite happy with it, though it is pretty complex and takes some time to be understood.
OTOH, if you want to keep the option available, that one day test1.pl and test2.pl, though being both part of your application, maybe again use different logging mechanisms, I suggest to turn them into modules (if your application logic allows this), and pass the necessary information about the logfiles as arguments.