Re: POE, log4perl and sqlite
[email protected] Wed, 17 Oct 2012 08:38:52 -0700 (PDT)
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 15 Oct 2012, Antti Linno wrote:
> 1) Do POE's sessions run in parallel? (ok, this might be obvious, but
> I have to be sure :) This might explain the database lock, as parallel
> session could write at the same time. Oddly this crash
> happens rarely.
Is using the database spawning multiple processes within POE? POE by
itself is single-process-single-threaded, but some components spawn
multiple processes, like this one:
http://cpansearch.perl.org/src/XANTUS/POE-Component-EasyDBI-1.23/lib/POE/Component/EasyDBI/SubProcess.pm
If you have multiple processes within POE, then I guess getting a SQLite
locked situation is possible.
> 2) Does POE::Component::Log4perl cure this problem?
This component is just a thin wrapper around Log4perl, and doesn't do
much except provide an easy to use POE-like interface.
If you're using a single-process-single-threaded POE application,
Log4perl won't have issues with multiple writes to a file. If you have
multiple processes, there's easy ways to avoid overlapping writes, as
outlined in the Log4perl FAQ:
http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#How_can_I_synchronize_access_to_an_appender?
--
-- Mike
Mike Schilli
[email protected]
>
> If there is no cure, will there be a problem with file based logging?
> I can switch from SQL to grep based search.
>
> Thanks,
> Antti
>