Thank you for your kind interest.

The pastebins:

log4perl.conf http://pastebin.com/nY4twgjS
main file http://pastebin.com/ruYsu2qt
application logic http://pastebin.com/hMyyBJ0U
database interaction http://pastebin.com/Cq7d4geK

As you can see, all the perl files are logging, main and application
import database functions. I have snipped the application and database
somewhat, but you could see the main structure and how I am doing the
logging.

Greetings.

On Thu, Oct 18, 2012 at 4:19 PM, Rocco Caputo <rcap...@pobox.com> wrote:
> On Oct 18, 2012, at 07:58, Antti Linno wrote:
>
>> First of all, I have to apologise. Still no pastebin.
>
> We have to apologize, too.  You're asking questions about code we cannot see. 
>  This impairs our ability to provide satisfying answers.
>
>> But a general tree would be something like that.
>>
>> Main POE module, imported submodule1, imported submodule2. All 3
>> modules open the same logger conf and use the same sqlite file to
>> append the log. Theoretically the log file could be locked, if all 3
>> or even 2 modules try to write at the same time.
>
> No.  As others have said, POE doesn't pre-empt.  Under ordinary 
> circumstances, we expect all three modules to call Log::Log4perl sequentially 
> rather than concurrently.  We don't expect Log::Log4perl suffer from lock 
> contention.
>
> It's very likely that something extraordinary is happening as a result of 
> code we cannot see.  Others have already outlined the most likely reasons for 
> the symptoms you described.  I hope you understand that's the best we can do 
> without your cooperation.
>
>> What would be the nice and tidy thing to do? Initialize logger in main
>> POE module and pass it to submodules?
>
> That's such a good question that Log::Log4perl already answers it:
>
> "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. However, this 
> requires that you pass around the object to all functions and the last thing 
> we want is pollute each and every function/method we're using with a handle 
> to the Logger:
>
> [example omitted]
>
> "Instead, if a function/method wants a reference to the logger, it just calls 
> the Logger's static get_logger($category) method to obtain a reference to the 
> one and only possible logger object of a certain category. That's called a 
> singleton if you're a Gamma fan."
>
> That quote is from 
> http://search.cpan.org/~mschilli/Log-Log4perl-1.38/lib/Log/Log4perl.pm#Initialize_via_a_configuration_file
>
> --
> Rocco Caputo <rcap...@pobox.com>

Reply via email to