r65775 - in /branches/upstream/liblog-handler-perl/current: ChangeLog META.yml README lib/Log/Handler.pm lib/Log/Handler/Output/DBI.pm

carnil at users.alioth.debian.org carnil at users.alioth.debian.org
Sun Dec 12 07:54:41 UTC 2010


Author: carnil
Date: Sun Dec 12 07:54:32 2010
New Revision: 65775

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=65775
Log:
[svn-upgrade] new version liblog-handler-perl (0.69)

Modified:
    branches/upstream/liblog-handler-perl/current/ChangeLog
    branches/upstream/liblog-handler-perl/current/META.yml
    branches/upstream/liblog-handler-perl/current/README
    branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm
    branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/DBI.pm

Modified: branches/upstream/liblog-handler-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/ChangeLog?rev=65775&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/ChangeLog (original)
+++ branches/upstream/liblog-handler-perl/current/ChangeLog Sun Dec 12 07:54:32 2010
@@ -1,3 +1,10 @@
+0.69    Released at 2010-12-11.
+        - Just a full release.
+
+0.68_01 Released at 2010-12-07.
+        - Added option dbi_handle to DBI.pm.
+        - Bug fix RT #63687.
+
 0.68    Released at 2010-11-24.
         - Fixed a bug in add(). It wasn't possible to pass more
           than one output configuration to add().

Modified: branches/upstream/liblog-handler-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/META.yml?rev=65775&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/META.yml (original)
+++ branches/upstream/liblog-handler-perl/current/META.yml Sun Dec 12 07:54:32 2010
@@ -1,6 +1,6 @@
 ---
 name: Log-Handler
-version: 0.68
+version: 0.69
 author:
   - Jonny Schulz
 abstract: Log messages to several outputs.
@@ -29,7 +29,7 @@
 provides:
   Log::Handler:
     file: lib/Log/Handler.pm
-    version: 0.68
+    version: 0.69
   Log::Handler::Config:
     file: lib/Log/Handler/Config.pm
     version: 0.07
@@ -41,7 +41,7 @@
     version: 0.08
   Log::Handler::Output::DBI:
     file: lib/Log/Handler/Output/DBI.pm
-    version: 0.10
+    version: 0.11
   Log::Handler::Output::Email:
     file: lib/Log/Handler/Output/Email.pm
     version: 0.08

Modified: branches/upstream/liblog-handler-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/README?rev=65775&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/README (original)
+++ branches/upstream/liblog-handler-perl/current/README Sun Dec 12 07:54:32 2010
@@ -311,7 +311,7 @@
             %r   Runtime in seconds since program start
             %t   Time measurement - replaced with the time since the last call of $log->$level
             %m   Message
-            %%   Procent
+            %%   Percent
 
         The default message layout is set to "%T [%L] %m".
 

Modified: branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm?rev=65775&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm (original)
+++ branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm Sun Dec 12 07:54:32 2010
@@ -352,7 +352,7 @@
     %r   Runtime in seconds since program start
     %t   Time measurement - replaced with the time since the last call of $log->$level
     %m   Message
-    %%   Procent
+    %%   Percent
 
 The default message layout is set to S<"%T [%L] %m">.
 
@@ -1051,7 +1051,7 @@
 use UNIVERSAL;
 use base qw(Log::Handler::Levels);
 
-our $VERSION = "0.68";
+our $VERSION = "0.69";
 our $ERRSTR  = "";
 
 # $TRACE and $CALLER_LEVEL are both used as global

Modified: branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/DBI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/DBI.pm?rev=65775&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/DBI.pm (original)
+++ branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/DBI.pm Sun Dec 12 07:54:32 2010
@@ -216,6 +216,20 @@
         time    => "2008-10-10 10:12:23",
     );
 
+Or you can connect to the database yourself. You should
+notice that if the database connection lost then the
+logger can't re-connect to the database and would return
+an error. Use C<dbi_handle> at your own risk.
+
+    my $dbh = DBI->connect(...);
+
+    my $db = Log::Handler::Output::DBI->new(
+        dbi_handle => $dbh,
+        table      => "messages",
+        columns    => [ qw/level ctime message/ ],
+        values     => [ qw/%level %time %message/ ],
+    );
+
 =head2 connect()
 
 Connect to the database.
@@ -274,7 +288,7 @@
 use Carp;
 use Params::Validate qw();
 
-our $VERSION = "0.10";
+our $VERSION = "0.11";
 our $ERRSTR  = "";
 
 sub new {
@@ -314,7 +328,7 @@
         return $self->_raise_error("DBI execute error: ".DBI->errstr);
     }
 
-    if (!$self->{persistent}) {
+    if (!$self->{persistent} && !$self->{dbi_handle}) {
         $self->disconnect or return undef;
     }
 
@@ -339,8 +353,19 @@
         warn "Connect to the database: $self->{cstr}->[0] ...";
     }
 
-    my $dbh = DBI->connect(@{$self->{cstr}})
-        or return $self->_raise_error("DBI connect error: ".DBI->errstr);
+    my $dbh;
+
+    if ($self->{dbi_handle}) {
+        # If db ping failed and dbi_handle and dbi is set
+        # then it seems that the database is down.
+        if ($self->{dbi}) {
+            return $self->_raise_error("dbi_handle - lost connection");
+        }
+        $dbh = $self->{dbi_handle};
+    } else {
+        $dbh = DBI->connect(@{$self->{cstr}})
+            or return $self->_raise_error("DBI connect error: ".DBI->errstr);
+    }
 
     my $sth = $dbh->prepare($self->{statement})
         or return $self->_raise_error("DBI prepare error: ".$dbh->errstr);
@@ -553,7 +578,7 @@
         $options{statement} .= ")";
     }
 
-    if ($options{driver} =~ /oracle/i) {
+    if ($options{driver} && $options{driver} =~ /oracle/i) {
         $options{pingstmt} = "select 1 from dual";
     } else {
         $options{pingstmt} = "select 1";




More information about the Pkg-perl-cvs-commits mailing list