rev 1784 - in trunk: Email-LocalDelivery-Ezmlm/lib/Email/LocalDelivery siesta siesta/lib

[prev] [thread] [next] [lurker] [Date index for 2005/01/26]

From: richardc
Subject: rev 1784 - in trunk: Email-LocalDelivery-Ezmlm/lib/Email/LocalDelivery siesta siesta/lib
Date: 13:37 on 26 Jan 2005
Author: richardc
Date: 2005-01-26 13:37:42 +0000 (Wed, 26 Jan 2005)
New Revision: 1784

Modified:
   trunk/Email-LocalDelivery-Ezmlm/lib/Email/LocalDelivery/Ezmlm.pm
   trunk/siesta/Config.pm.in
   trunk/siesta/lib/Siesta.pm
Log:
kludge in Log4perl stuff to diagnose hates-software

Modified: trunk/Email-LocalDelivery-Ezmlm/lib/Email/LocalDelivery/Ezmlm.pm
===================================================================
--- trunk/Email-LocalDelivery-Ezmlm/lib/Email/LocalDelivery/Ezmlm.pm	2005-01-02 08:58:27 UTC (rev 1783)
+++ trunk/Email-LocalDelivery-Ezmlm/lib/Email/LocalDelivery/Ezmlm.pm	2005-01-26 13:37:42 UTC (rev 1784)
@@ -3,7 +3,10 @@
 our $VERSION = '0.10';
 use File::Path qw(mkpath);
 use File::Basename qw( dirname );
+use Log::Log4perl;
 
+our $logger = Log::Log4perl::get_logger();
+
 =head1 NAME
 
 Email::LocalDelivery::Ezmlm - deliver mail into ezmlm archives
@@ -35,6 +38,7 @@
 
     my @delivered;
     for my $folder (@folders) {
+        $logger->info( "delivering for '$folder'" );
         # trim the identifier off, as mkpath doesn't get on with it
         $folder =~ s{//?$}{};
         # XXX should lock the folder - figure out how ezmlm does that
@@ -44,18 +48,29 @@
             ($num) = (<$fh> =~ m/^(\d+)/);
         }
         ++$num;
+        $logger->debug( "num: $num" );
 
         my $filename = sprintf('%s/archive/%d/%02d',
                                $folder, int $num / 100, $num % 100);
         eval { mkpath( dirname $filename ) };
-        open my $fh, ">$filename" or next;
+        open my $fh, ">$filename" or do {
+            $logger->debug( "couldn't open '$filename': $!" );
+            next;
+        };
         print $fh $mail;
-        close $fh or next;
-
-        open $fh, ">$folder/num" or do { unlink $filename; next };
+        close $fh or do {
+            $logger->debug( "problem closing '$filename': $!" );
+            next;
+        };
+        open $fh, ">$folder/num" or do {
+            $logger->debug( "couldn't open num file: $!" );
+            unlink $filename;
+            next;
+        };
         print $fh "$num\n";
-        close $fh or die "couldn't rewrite '$folder/num' $!";
+        close $fh or $logger->logdie( "couldn't rewrite '$folder/num' $!" );
         push @delivered, $filename;
+        $logger->info( "delivered message $num into '$folder'" );
     }
     return @delivered;
 }

Modified: trunk/siesta/Config.pm.in
===================================================================
--- trunk/siesta/Config.pm.in	2005-01-02 08:58:27 UTC (rev 1783)
+++ trunk/siesta/Config.pm.in	2005-01-26 13:37:42 UTC (rev 1784)
@@ -158,6 +158,11 @@
 }
 
 
+
+$config->load_from( $CONFIG_FILE );
+
+
+
 sub storage {
     my $self = shift;
     if (@_) {

Modified: trunk/siesta/lib/Siesta.pm
===================================================================
--- trunk/siesta/lib/Siesta.pm	2005-01-02 08:58:27 UTC (rev 1783)
+++ trunk/siesta/lib/Siesta.pm	2005-01-26 13:37:42 UTC (rev 1784)
@@ -5,6 +5,8 @@
 use UNIVERSAL::require;
 use Template;
 use Carp qw(croak);
+use Log::Log4perl;
+Log::Log4perl::init('/usr/local/siesta/log.conf');
 
 use Siesta::Config;
 use Siesta::List;

Generated at 15:01 on 01 Feb 2007 by mariachi 0.52