My Log4perl chops are extremely stale at this point. My question would be, is it properly the logger’s responsibility? Log4perl can send email and such too but you would never expect it to configure/start sendmail as a part of normal “just in time” operations. I think the application consuming the logger should be responsible for setting up the DB. That said, this might do it. See also: Log::Log4perl::FAQ. Completely untested–
log4perl.appender.app_db.datasource = sub { \ require DBI; \ my $connect_info = "dbi:SQLite:uri=file:log4perl.sqlite"; \ my $dbh = DBI->connect($connect_info); \ # ERROR handling, possible DB creation left out! \ $dbh->do(<<"_SQL_"); \ CREATE TABLE IF NOT EXISTS log ( \ # ... table definition .... \ ); \ _SQL_ \ $connect_info; \ }
In reply to Re^3: Log4perl: Create missing SQLite file and log to it
by Your Mother
in thread Log4perl: Create missing SQLite file and log to it
by mbloecker
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |