Posted on 2008-11-25 16:03:33-08 by soimulpatriei
Log different messages in different files
Hello,
I want to log different messages in different files using one log object per package. For example, assume I have two functions in my package func1 and func 2. All messages from func1 should go to file1 and the messages from func2 should go to file2. I solve the problem creating in each function a log object and associating it with an appender, but from the official log4perl doc I understand that this is bad practice:
"Why Log::Log4perl-get_logger and not Log::Log4perl-new? We don't want to create a new object every time. Usually in OO-Programming, you create an object once and use the reference to it to call its methods."
So how I maintain one logger per category (package) and in the same time I log the messages of different functions in different files. Thanks!
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.