Index: trunk/PS-IPP-Config/lib/PS/IPP/Config.pm
===================================================================
--- trunk/PS-IPP-Config/lib/PS/IPP/Config.pm	(revision 31907)
+++ trunk/PS-IPP-Config/lib/PS/IPP/Config.pm	(revision 32374)
@@ -20,4 +20,5 @@
 use Getopt::Long 2.33 qw( GetOptions :config gnu_getopt pass_through ); # Set pass_through so we don't kill @ARGV
 use IPC::Cmd 0.36 qw( can_run run );
+use POSIX qw( strftime );
 
 use base qw( Exporter Class::Accessor::Fast );
@@ -692,4 +693,6 @@
 }
 
+
+
 # redirect stderr and stdout streams to a file
 sub redirect_output
@@ -722,4 +725,43 @@
 
     return 1;
+}
+
+# redirect stderr and stdout streams to log file. If file already exists rename it and record
+# the name in the new log file.
+sub redirect_to_logfile {
+    my $self = shift;
+    my $name = shift;
+    
+    my $tstring = strftime "%Y%m%dT%H%M", gmtime;
+
+    my $old_name;
+    my $scheme = file_scheme($name);
+    if ($scheme eq 'neb') {
+        my $neb = $self->nebulous;
+        if ($neb->storage_object_exists($name)) {
+            eval {
+                $old_name = "$name.$tstring";
+                $neb->move($name, $old_name);
+            };
+            if ($@) {
+                carp "nebulous move failed for $name";
+                return undef;
+            }
+        }
+    } else {
+        if ($self->file_exists($name)) {
+            my $resolved = $self->file_resolve($name);
+            $old_name = "$resolved.$tstring";
+            if (!rename($resolved, $old_name)) {
+                carp "Failed to rename $resolved $old_name";
+                return undef;
+            }
+        }
+    }
+    my $result = $self->redirect_output($name);
+    if ($result and $old_name) {
+        print "\nPrevious log file moved to $old_name\n";
+    }
+    return $result;
 }
 
