Index: /trunk/ippScripts/scripts/detrend_correct_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_correct_imfile.pl	(revision 18047)
+++ /trunk/ippScripts/scripts/detrend_correct_imfile.pl	(revision 18048)
@@ -25,5 +25,5 @@
 
 my ( $det_id, $exp_id, $class_id, $det_type, $exp_tag, $input_uri, $camera, $dbname, $workdir, $reduction,
-     $verbose, $no_update, $no_op );
+     $verbose, $no_update, $no_op, $outroot, $redirect, $corr_id, $corr_type, $corr_uri );
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -41,4 +41,6 @@
     'no-update'         => \$no_update,
     'no-op'             => \$no_op,
+    'outroot'           => \$outroot,
+    'redirect-output'   => \$redirect,
 ) or pod2usage( 2 );
 
@@ -56,4 +58,11 @@
 # XXX this exits with status = 0 on failure
 $ipprc->define_camera($camera);
+
+if ($redirect) {
+    die "must suplly --outroot with --redirect-output" if !defined ($outroot);
+    my $logDest     = $ipprc->filename("LOG.IMFILE", $outroot, $class_id)
+       or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+    $ipprc->redirect_output($logDest);
+}
 
 # Recipes to use as a function of detrend type
Index: /trunk/ippScripts/scripts/detrend_norm_apply.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_norm_apply.pl	(revision 18047)
+++ /trunk/ippScripts/scripts/detrend_norm_apply.pl	(revision 18048)
@@ -26,5 +26,5 @@
 # Parse the command-line
 my ( $det_id, $iter, $class_id, $value, $input_uri, $camera, $det_type, $outroot, $dbname, $verbose,
-     $no_update, $no_op );
+     $no_update, $no_op, $redirect );
 GetOptions(
     'det_id|d=s'        => \$det_id,     # Detrend ID
@@ -40,4 +40,5 @@
     'no-update'         => \$no_update,  # Don't update the database
     'no-op'             => \$no_op,      # Don't do any operations
+    'redirect-output'   => \$redirect,   # send output from script to LOG.IMFILE
     ) or pod2usage( 2 );
 
@@ -56,4 +57,8 @@
 $ipprc->define_camera($camera);
 
+my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) 
+        or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
+$ipprc->redirect_output($logDest) if $redirect;
+
 my $RECIPE_PPIMAGE = 'PPIMAGE_N'; # Recipe to use with ppImage
 my $RECIPE_PPSTATS = 'CHIPSTATS'; # Recipe to use with ppStats
@@ -100,5 +105,4 @@
 my $statsName = $ipprc->filename("PPIMAGE.STATS", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
 my $traceDest = $ipprc->filename("TRACE.IMFILE",  $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
-my $logDest   = $ipprc->filename("LOG.IMFILE",    $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
 
 # Run normalisation
Index: /trunk/ippScripts/scripts/detrend_process_exp.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_process_exp.pl	(revision 18047)
+++ /trunk/ippScripts/scripts/detrend_process_exp.pl	(revision 18048)
@@ -27,5 +27,5 @@
 
 my ( $det_id, $exp_id, $det_type, $exp_tag, $camera, $outroot, $dbname, $reduction, $verbose, $no_update,
-     $no_op, $save_temps );
+     $no_op, $save_temps, $redirect );
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -41,4 +41,5 @@
     'no-op'             => \$no_op,
     'save-temps'        => \$save_temps, # Save temporary files?
+    'redirect-output'   => \$redirect,
 ) or pod2usage( 2 );
 
@@ -54,4 +55,10 @@
 
 $ipprc->define_camera($camera);
+
+if ($redirect) {
+    my $logDest = $ipprc->filename("LOG.EXP", $outroot, "NONE") 
+        or &my_die("Missing entry in file rules", $det_id, $exp_id, $PS_EXIT_CONFIG_ERROR);
+    $ipprc->redirect_output($logDest);
+}
 
 # Recipes to use based on reduction class
Index: /trunk/ippScripts/scripts/detrend_process_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_process_imfile.pl	(revision 18047)
+++ /trunk/ippScripts/scripts/detrend_process_imfile.pl	(revision 18048)
@@ -25,5 +25,5 @@
 
 my ( $det_id, $exp_id, $class_id, $det_type, $exp_tag, $input_uri, $camera, $outroot, $dbname, $reduction,
-     $verbose, $no_update, $no_op );
+     $verbose, $no_update, $no_op, $redirect );
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -40,4 +40,5 @@
     'no-update'         => \$no_update,
     'no-op'             => \$no_op,
+    'redirect-output'   => \$redirect,
 ) or pod2usage( 2 );
 
@@ -56,4 +57,9 @@
 # XXX this exits with status = 0 on failure
 $ipprc->define_camera($camera);
+
+my $logDest     = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id)
+      or &my_die("Missing entry from camera config", $exp_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+
+$ipprc->redirect_output($logDest) if $redirect;
 
 # Recipes to use as a function of detrend type
@@ -95,6 +101,4 @@
 my $outputStats = $ipprc->filename("PPIMAGE.STATS",  $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
 my $traceDest   = $ipprc->filename("TRACE.IMFILE",   $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-my $logDest     = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-
 # Run ppImage
 unless ($no_op) {
Index: /trunk/ippScripts/scripts/detrend_reject_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_reject_imfile.pl	(revision 18047)
+++ /trunk/ippScripts/scripts/detrend_reject_imfile.pl	(revision 18048)
@@ -36,5 +36,5 @@
 # parse the command-line options
 my ( $det_id, $iter, $exp_id, $exp_tag, $det_type, $camera, $filter, $reject, $outroot, $dbname, $reduction,
-     $verbose, $no_update, $no_op, $save_temps );
+     $verbose, $no_update, $no_op, $save_temps, $redirect );
 GetOptions(
            'det_id|d=s'        => \$det_id,
@@ -53,4 +53,5 @@
            'no-op'             => \$no_op,
            'save-temps'        => \$save_temps, # Save temporary files?
+           'redirect-output'   => \$redirect,   # redirect output from LOG.IMFILE
            ) or pod2usage( 2 );
 
@@ -68,4 +69,12 @@
 # load IPP config information for the specified camera
 $ipprc->define_camera($camera);
+if ($redirect) {
+    # XXX should this really be going to LOG.IMFILE?
+    # That's where detrend.resid.pro was sending it
+    my $logDest     = $ipprc->filename("LOG.IMFILE", $outroot, "NONE")
+       or &my_die("Missing entry from camera config", $det_id, $iter, $exp_id, $PS_EXIT_CONFIG_ERROR);
+    $ipprc->redirect_output($logDest);
+}
+
 
 # Recipes to use based on reduction class
Index: /trunk/ippScripts/scripts/detrend_resid.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_resid.pl	(revision 18047)
+++ /trunk/ippScripts/scripts/detrend_resid.pl	(revision 18048)
@@ -25,5 +25,5 @@
 
 my ( $det_id, $iter, $exp_id, $exp_tag, $class_id, $det_type, $detrend, $input_uri, $camera, $mode, $outroot,
-     $dbname, $reduction, $verbose, $no_update, $no_op );
+     $dbname, $reduction, $verbose, $no_update, $no_op, $redirect );
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -43,4 +43,5 @@
     'no-update'         => \$no_update,
     'no-op'             => \$no_op,
+    'redirect-output'   => \$redirect,
 ) or pod2usage( 2 );
 
@@ -61,4 +62,8 @@
 
 $ipprc->define_camera($camera);
+my $logDest     = $ipprc->filename("LOG.IMFILE", $outroot, $class_id);
+if ($redirect) {
+    $ipprc->redirect_output($logDest);
+}
 
 # Recipes to use as a function of detrend type and mode
@@ -137,5 +142,4 @@
 my $outputStats = $ipprc->filename("PPIMAGE.STATS",  $outroot, $class_id);
 my $traceDest   = $ipprc->filename("TRACE.IMFILE",   $outroot, $class_id);
-my $logDest     = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id);
 
 # Run ppImage & ppStats
Index: /trunk/ippScripts/scripts/detrend_stack.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_stack.pl	(revision 18047)
+++ /trunk/ippScripts/scripts/detrend_stack.pl	(revision 18048)
@@ -18,5 +18,4 @@
 use PS::IPP::Metadata::Stats;
 use PS::IPP::Metadata::List qw( parse_md_list );
-use File::Temp qw( tempfile );
 use PS::IPP::Config 1.01 qw( :standard );
 
@@ -27,5 +26,5 @@
 
 my ( $det_id, $iter, $class_id, $det_type, $camera, $outroot, $dbname, $reduction, $verbose, $save_temps,
-     $no_update, $no_op );
+     $no_update, $no_op, $redirect );
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -35,5 +34,5 @@
     'camera|c=s'        => \$camera,
     'outroot|w=s'       => \$outroot,   # output file base name
-    'dbname|d=s'        => \$dbname, # Database name
+    'dbname|d=s'        => \$dbname,    # Database name
     'reduction=s'       => \$reduction, # Reduction class for processing
     'verbose'           => \$verbose,   # Print to stdout
@@ -41,5 +40,7 @@
     'no-update'         => \$no_update,
     'no-op'             => \$no_op,
+    'redirect-output'   => \$redirect,
 ) or pod2usage( 2 );
+
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
@@ -55,4 +56,10 @@
 $ipprc->define_camera($camera);
 $det_type = uc($det_type);
+
+my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id)
+    or &my_die("Missing entry in file rules", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
+
+# optionally redirect the outputs from this script to LOG.IMFILE
+$ipprc->redirect_output($logDest) if $redirect;
 
 # Recipes to use as a function of detrend type
@@ -121,5 +128,6 @@
 
 # Generate MDC file with the inputs
-my ($listFile, $listName) = tempfile( $ipprc->file_resolve("$outroot.$class_id.list.XXXX"), UNLINK => !$save_temps );
+my ($listFile, $listName) = $ipprc->create_temp_file("$outroot.$class_id.list", $save_temps);
+
 my $num = 0;
 foreach my $file (@$files) {
@@ -161,5 +169,4 @@
 my $outputStats = $ipprc->filename("PPIMAGE.STATS",  $outroot, $class_id) or &my_die("Missing entry in file rules", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR); # Statistics name
 my $traceDest   = $ipprc->filename("TRACE.IMFILE",   $outroot, $class_id) or &my_die("Missing entry in file rules", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR); # Trace messages
-my $logDest     = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id) or &my_die("Missing entry in file rules", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR); # Log messages
 
 $command = "$ppMerge $listName $outroot"; # Command to run
Index: /trunk/ippTasks/detrend.correct.pro
===================================================================
--- /trunk/ippTasks/detrend.correct.pro	(revision 18047)
+++ /trunk/ippTasks/detrend.correct.pro	(revision 18048)
@@ -5,7 +5,4 @@
 # test for required global variables
 check.globals
-
-$LOGSUBDIR = $LOGDIR/detrend
-exec mkdir -p $LOGSUBDIR
 
 book init detPendingCorrectedImfile
@@ -71,5 +68,5 @@
 
   stdout NULL
-  stderr $LOGSUBDIR/detcorr.imfile.log
+  stderr $LOGDIR/detcorr.load.log
 
   task.exec
@@ -146,18 +143,8 @@
     sprintf outroot "%s/%s.%s.%s/%s/%s.detcorr.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
 
-    $logfile = `ipp_filename.pl --touch --filerule LOG.IMFILE --camera $CAMERA --class_id $CLASS_ID --basename $outroot`
-    if ("$logfile" == "") 
-      echo "WARNING: logfile not defined in detrend.correct.pro:150"
-      break
-    end
-
-    stdout $logfile
-    stderr $logfile
-    dirname $logfile -var outpath
-
-    # XXX I need to report the error if this fails...
-    mkdir $outpath
-
-    $run = detrend_correct_imfile.pl --det_id $DET_ID --exp_id $EXP_ID --class_id $CLASS_ID --exp_tag $EXP_TAG --input_uri $URI --corr_id $CORR_ID --corr_type $CORR_TYPE --camera $CAMERA
+    stdout $LOGDIR/detcorr.run.log
+    stderr $LOGDIR/detcorr.run.log
+
+    $run = detrend_correct_imfile.pl --det_id $DET_ID --exp_id $EXP_ID --class_id $CLASS_ID --exp_tag $EXP_TAG --input_uri $URI --corr_id $CORR_ID --corr_type $CORR_TYPE --camera $CAMERA --outroot $outroot --redirect-output
     if ("$WORKDIR" != "NULL")
       $run = $run --workdir $WORKDIR
@@ -202,5 +189,5 @@
 
   stdout NULL
-  stderr $LOGSUBDIR/detcorr.exp.log
+  stderr $LOGDIR/detcorr.exp.load.log
 
   task.exec
@@ -275,16 +262,9 @@
     sprintf outroot "%s/%s.%s.%s/%s/%s.detcorr.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
 
-    ## generate output log based on filerule (convert the URI to a PATH)
-    $logfile = `ipp_filename.pl --touch --filerule LOG.EXP --camera $CAMERA --class_id NONE --basename $outroot`
-    if ("$logfile" == "") 
-      $logfile = $outroot.log
-    end
-
-    stdout $logfile
-    stderr $logfile
-    dirname $logfile -var outpath
-    mkdir $outpath
-
-    $run = detrend_correct_exp.pl --det_id $DET_ID --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --corr_id $CORR_ID --corr_type $CORR_TYPE --camera $CAMERA
+    stdout $LOGDIR/detcorr.exp.run.log
+    stderr $LOGDIR/detcorr.exp.run.log
+
+    $run = detrend_correct_exp.pl --det_id $DET_ID --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --corr_id $CORR_ID --corr_type $CORR_TYPE --camera $CAMERA --redirect-output
+
     if ("$WORKDIR" != "NULL")
       $run = $run --workdir $WORKDIR
Index: /trunk/ippTasks/detrend.norm.pro
===================================================================
--- /trunk/ippTasks/detrend.norm.pro	(revision 18047)
+++ /trunk/ippTasks/detrend.norm.pro	(revision 18048)
@@ -5,7 +5,4 @@
 # test for required global variables
 check.globals
-
-$LOGSUBDIR = $LOGDIR/detrend
-exec mkdir -p $LOGSUBDIR
 
 book init detPendingNormStatImfile
@@ -84,5 +81,5 @@
 
   stdout NULL
-  stderr $LOGSUBDIR/detrend.normstat.log
+  stderr $LOGDIR/detrend.normstat.load.log
 
   task.exec
@@ -199,5 +196,5 @@
 
   stdout NULL
-  stderr $LOGSUBDIR/detrend.norm.log
+  stderr $LOGDIR/detrend.norm.load.log
 
   task.exec
@@ -272,13 +269,8 @@
     sprintf outroot "%s/%s.%s.%s/%s.%s.norm.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $CAMERA $DET_TYPE $DET_ID $ITERATION
 
-    ## generate output log
-    $logfile = `ipp_filename.pl --touch --filerule LOG.IMFILE --camera $CAMERA --class_id $CLASS_ID --basename $outroot`
-
-    stdout $logfile
-    stderr $logfile
-    dirname $logfile -var outpath
-    mkdir $outpath
-
-    $run = detrend_norm_apply.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --value $NORM --input_uri $URI --camera $CAMERA --det_type $DET_TYPE --outroot $outroot
+    stdout $LOGDIR/detrend.norm.run.log
+    stderr $LOGDIR/detrend.norm.run.log
+
+    $run = detrend_norm_apply.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --value $NORM --input_uri $URI --camera $CAMERA --det_type $DET_TYPE --outroot $outroot --redirect-output
     add_standard_args run
     
@@ -317,5 +309,5 @@
 
   stdout NULL
-  stderr $LOGSUBDIR/detrend.normexp.log
+  stderr $LOGDIR/detrend.normexp.load.log
 
   task.exec
Index: /trunk/ippTasks/detrend.process.pro
===================================================================
--- /trunk/ippTasks/detrend.process.pro	(revision 18047)
+++ /trunk/ippTasks/detrend.process.pro	(revision 18048)
@@ -5,7 +5,4 @@
 # test for required global variables
 check.globals
-
-$LOGSUBDIR = $LOGDIR/detrend
-exec mkdir -p $LOGSUBDIR
 
 book init detPendingProcessedImfile
@@ -71,5 +68,5 @@
 
   stdout NULL
-  stderr $LOGSUBDIR/detproc.imfile.log
+  stderr $LOGDIR/detproc.imfile.load.log
 
   task.exec
@@ -152,6 +149,6 @@
     end
 
-    stdout $logfile
-    stderr $logfile
+    stdout $LOGDIR/detproc.imfile.run.log
+    stderr $LOGDIR/detproc.imfile.run.log
     dirname $logfile -var outpath
 
@@ -159,5 +156,5 @@
     mkdir $outpath
 
-    $run = detrend_process_imfile.pl --det_id $DET_ID --exp_id $EXP_ID --det_type $DET_TYPE --class_id $CLASS_ID --exp_tag $EXP_TAG --input_uri $URI --camera $CAMERA --outroot $outroot
+    $run = detrend_process_imfile.pl --det_id $DET_ID --exp_id $EXP_ID --det_type $DET_TYPE --class_id $CLASS_ID --exp_tag $EXP_TAG --input_uri $URI --camera $CAMERA --outroot $outroot --redirect-output
     if ("$REDUCTION" != "NULL")
       $run = $run --reduction $REDUCTION
@@ -199,5 +196,5 @@
 
   stdout NULL
-  stderr $LOGSUBDIR/detproc.exp.log
+  stderr $LOGDIR/detproc.exp.load.log
 
   task.exec
@@ -271,17 +268,8 @@
     sprintf outroot "%s/%s.%s.%s/%s/%s.detproc.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
 
-    ## generate output log based on filerule (convert the URI to a PATH)
-    $logfile = `ipp_filename.pl --touch --filerule LOG.EXP --camera $CAMERA --class_id NONE --basename $outroot`
-    if ("$logfile" == "") 
-      echo "WARNING: logfile not defined in detrend.process.pro:282"
-      break
-    end
-
-    stdout $logfile
-    stderr $logfile
-    dirname $logfile -var outpath
-    mkdir $outpath
-
-    $run = detrend_process_exp.pl --det_id $DET_ID --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --outroot $outroot
+    stdout $LOGDIR/detproc.exp.run.log
+    stderr $LOGDIR/detproc.exp.run.log
+
+    $run = detrend_process_exp.pl --det_id $DET_ID --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --outroot $outroot --redirect-output
     if ("$REDUCTION" != "NULL")
       $run = $run --reduction $REDUCTION
Index: /trunk/ippTasks/detrend.resid.pro
===================================================================
--- /trunk/ippTasks/detrend.resid.pro	(revision 18047)
+++ /trunk/ippTasks/detrend.resid.pro	(revision 18048)
@@ -5,7 +5,4 @@
 # test for required global variables
 check.globals
-
-$LOGSUBDIR = $LOGDIR/detrend
-exec mkdir -p $LOGSUBDIR
 
 book init detPendingResidImfile
@@ -68,5 +65,5 @@
 
   stdout NULL
-  stderr $LOGSUBDIR/detresid.log
+  stderr $LOGDIR/detresid.load.log
 
   task.exec
@@ -145,17 +142,8 @@
     sprintf outroot "%s/%s.%s.%s/%s/%s.detresid.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID $ITERATION
 
-    ## generate output log based on filerule (convert the URI to a PATH)
-    $logfile = `ipp_filename.pl --touch --filerule LOG.IMFILE --camera $CAMERA --class_id $CLASS_ID --basename $outroot`
-    if ("$logfile" == "") 
-      echo "WARNING: logfile not defined in detrend.resid.pro:161"
-      break
-    end
-
-    stdout $logfile
-    stderr $logfile
-    dirname $logfile -var outpath
-    mkdir $outpath
-
-    $run = detrend_resid.pl --det_id $DET_ID --iteration $ITERATION --exp_id $EXP_ID --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URI --input_uri $URI --camera $CAMERA --mode $MODE --outroot $outroot
+    stdout $LOGDIR/detresid.run.log
+    stderr $LOGDIR/detresid.run.log
+
+    $run = detrend_resid.pl --det_id $DET_ID --iteration $ITERATION --exp_id $EXP_ID --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URI --input_uri $URI --camera $CAMERA --mode $MODE --outroot $outroot --redirect-output
     if ("$REDUCTION" != "NULL")
       $run = $run --reduction $REDUCTION
@@ -197,5 +185,5 @@
 
   stdout NULL
-  stderr $LOGSUBDIR/detresid.exp.log
+  stderr $LOGDIR/detresid.exp.load.log
 
   task.exec
@@ -271,17 +259,8 @@
     sprintf outroot "%s/%s.%s.%s/%s/%s.detresid.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID $ITERATION
 
-    ## generate output log based on filerule (convert the URI to a PATH)
-    $logfile = `ipp_filename.pl --touch --filerule LOG.IMFILE --camera $CAMERA --class_id NONE --basename $outroot`
-    if ("$logfile" == "") 
-      echo "WARNING: logfile not defined in detrend.process.pro:285"
-      break
-    end
-
-    stdout $logfile
-    stderr $logfile
-    dirname $logfile -var outpath
-    mkdir $outpath
-
-    $run = detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITERATION --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --outroot $outroot
+    stdout $LOGDIR/detresid.exp.run.log
+    stderr $LOGDIR/detresid.exp.run.log
+
+    $run = detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITERATION --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --outroot $outroot --redirect-output
     add_standard_args run
 
Index: /trunk/ippTasks/detrend.stack.pro
===================================================================
--- /trunk/ippTasks/detrend.stack.pro	(revision 18047)
+++ /trunk/ippTasks/detrend.stack.pro	(revision 18048)
@@ -5,7 +5,4 @@
 # test for required global variables
 check.globals
-
-$LOGSUBDIR = $LOGDIR/detrend
-exec mkdir -p $LOGSUBDIR
 
 book init detPendingStackedImfile
@@ -53,5 +50,5 @@
 
   stdout NULL
-  stderr $LOGSUBDIR/detstack.log
+  stderr $LOGDIR/detrend.stack.load.log
 
   task.exec
@@ -125,17 +122,8 @@
     sprintf outroot "%s/%s.%s.%s/%s.%s.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $CAMERA $DET_TYPE $DET_ID $ITERATION
 
-    ## generate output log based on filerule (convert the URI to a PATH)
-    $logfile = `ipp_filename.pl --touch --filerule LOG.IMFILE --camera $CAMERA --class_id $CLASS_ID --basename $outroot`
-    if ("$logfile" == "") 
-      echo "WARNING: logfile not defined in detrend.stack.pro:141"
-      break
-    end
+    stdout $LOGDIR/detrend.stack.run.log
+    stderr $LOGDIR/detrend.stack.run.log
 
-    stdout $logfile
-    stderr $logfile
-    dirname $logfile -var outpath
-    mkdir $outpath
-
-    $run = detrend_stack.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA --outroot $outroot
+    $run = detrend_stack.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA --outroot $outroot --redirect-output
     if ("$REDUCTION" != "NULL")
       $run = $run --reduction $REDUCTION
