Skip Menu |

This queue is for tickets about the Log-Handler CPAN distribution.

Report information
The Basics
Id: 81155
Status: resolved
Priority: 0/
Queue: Log-Handler

People
Owner: Nobody in particular
Requestors: RSAVAGE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.75
Fixed in: (no value)



Subject: Validation fails when I use new(dbi_handle => ...)
Hi There is no validation in Log::Handler::Output::DBI for dbi_handle in _validate(), so it always produces an error. The reason I want to do this is that now I use DBI::Connection, and I want to pass its dbh to Log::Handler::Output::DBI, rather than having to create a separate dbh.
Hi Ron! Strange, but you are right. I will fix it today and upload it to CPAN. Cheers, Jonny
0.76 uploaded. Please test it and give me a feedback.
Done.
Subject: Re: [rt.cpan.org #81155] Validation fails when I use new(dbi_handle => ...)
Date: Fri, 30 Nov 2012 11:46:18 +1100
To: bug-Log-Handler [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Jonny On 19/11/12 19:24, Jonny Schulz via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=81155> > > 0.76 uploaded. Please test it and give me a feedback.
Yes. Working now. $many x $thanx; -- Ron Savage http://savage.net.au/ Ph: 0421 920 622
Hi Jonny Errrr. It works sometimes. See attached program, which demonstrates the problem I have. Or, have I done something silly? Cheers
Subject: test.config.pl
#!/usr/bin/env perl use feature qw/say unicode_strings/; use open qw(:std :utf8); use strict; use warnings; use warnings qw(FATAL utf8); use DBI; use Log::Handler; # ---------------- my($dsn) = 'dbi:SQLite:dbname=/tmp/demo.sqlite'; my($dbh) = DBI -> connect($dsn, '', '', {AutoCommit => 1, RaiseError => 1}); my($logger) = Log::Handler -> new; $logger -> add ( dbi => { columns => [qw/level message/], dbi_handle => $dbh, persistent => 1, table => 'log', values => [qw/%level %message/], } ); $dbh -> do('drop table if exists log'); $dbh -> do(<<EOS); create table log ( id integer primary key autoincrement, level varchar(9) not null, message text not null, timestamp timestamp not null default current_timestamp ) EOS my($sth) = $dbh -> prepare('insert into log (level, message) values (?, ?)'); $sth -> execute('debug', 'one'); $sth -> finish; $logger -> log(notice => 'two'); $logger -> notice('three'); say 'Printing the data. Expect 3 lines...'; for my $row (@{$dbh -> selectall_arrayref('select * from log order by id', {Slice => {} })}) { say join(', ', map{"$_ => '$$row{$_}'"} sort keys %$row); } say '-' x 50; $sth -> finish;
On Mon Dec 03 22:00:19 2012, RSAVAGE wrote: Show quoted text
> Hi Jonny > > Errrr. It works sometimes. See attached program, which demonstrates
the Show quoted text
> problem I have. > > Or, have I done something silly? > > Cheers
From the documentation: "The default setting for maxlevel is warning and the default setting for minlevel is emergency." Ok? ;-)
Done.