Index: trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh
===================================================================
--- trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh	(revision 1109)
+++ trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh	(revision 1115)
@@ -30,29 +30,4 @@
 # GENERATE RANDOM ERROR ; only apply if ( ${DEBUG_debug} )
 typeset RandomError=false
-
-# Stack file containing call tree will be stored there.
-if ( $DEBUG_debug ) ; then
-  if [ X${TaskType} = Xcomputing ]; then
-    typeset StackFileLocation=${StackFileLocation:=${PWD}/STACK}
-    typeset StackFileName=computing.stack.$$
-    [ ! -d ${StackFileLocation} ] && mkdir -p ${StackFileLocation}
-  elif [ X${TaskType} = Xpost-processing ]; then
-    typeset StackFileLocation=${POST_DIR:=${StackFileLocation}}
-    typeset StackFileName=post-processing.stack.$$
-  elif [ X${TaskType} = Xchecking ]; then
-    typeset StackFileLocation=${POST_DIR:=${PWD}}
-    typeset StackFileName=checking.stack.$$
-  else
-    typeset StackFileLocation=${POST_DIR:=${PWD}}
-    typeset StackFileName=checking.stack.$$
-  fi
-
-  if [ -f ${StackFileLocation}/${StackFileName} ] ;
-  then
-    echo "Stack of an libIGCM job :" >> ${StackFileLocation}/${StackFileName}
-  else
-    echo "Stack of an libIGCM job :" >  ${StackFileLocation}/${StackFileName}
-  fi
-fi
 
 #==================================================
@@ -229,11 +204,13 @@
 
   # Only cosmetics : stack file
-  decal=0
-  while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
-    printf ' ' >> ${StackFileLocation}/${StackFileName}
-    (( decal = decal + 1 ))
-  done
-  # Log to stack file using human readable format
-  echo "${Body}" >> ${StackFileLocation}/${StackFileName}
+  if [ X${ActivateStackFilling} = Xtrue ] ; then
+    decal=0
+    while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
+      printf ' ' >> ${StackFileLocation}/${StackFileName}
+      (( decal = decal + 1 ))
+    done
+    # Log to stack file using human readable format
+    echo "${Body}" >> ${StackFileLocation}/${StackFileName}
+  fi
 
   # Log separately encoded AMQP message command for reuse in a mock up
@@ -286,13 +263,15 @@
 
     # Only cosmetics : stack file
-    echo >> ${StackFileLocation}/${StackFileName}
-    decal=0
-    while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
-      printf ' ' >> ${StackFileLocation}/${StackFileName}
-      (( decal = decal + 1 ))
-    done
-
-    # Fill the stack file
-    echo "> ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/${StackFileName}
+    if [ X${ActivateStackFilling} = Xtrue ] ; then
+      echo >> ${StackFileLocation}/${StackFileName}
+      decal=0
+      while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
+        printf ' ' >> ${StackFileLocation}/${StackFileName}
+        (( decal = decal + 1 ))
+      done
+
+      # Fill the stack file
+      echo "> ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/${StackFileName}
+    fi
 
     # Save input list in an indexed array
@@ -351,5 +330,7 @@
       if [ $((RANDOM%10000)) -le 10 ] ; then
         IGCM_debug_Print 1 "Random error has been triggered"
-        echo "RANDOM ERROR" >> ${StackFileLocation}/${StackFileName}
+        if [ X${ActivateStackFilling} = Xtrue ] ; then
+          echo "RANDOM ERROR" >> ${StackFileLocation}/${StackFileName}
+        fi
         ExitFlag=true
       fi
@@ -503,13 +484,17 @@
 
     # Only cosmetics : stack file
-    decal=0
-    while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
-      printf ' ' >> ${StackFileLocation}/${StackFileName}
-      (( decal = decal + 1 ))
-    done
+    if [ X${ActivateStackFilling} = Xtrue ] ; then
+      decal=0
+      while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do
+        printf ' ' >> ${StackFileLocation}/${StackFileName}
+        (( decal = decal + 1 ))
+      done
+    fi
 
     if ( ${ExitFlag} ) ; then
       # Inform the stack file
-      echo '!!! ExitFlag has been activated !!!' >> ${StackFileLocation}/${StackFileName}
+      if [ X${ActivateStackFilling} = Xtrue ] ; then
+        echo '!!! ExitFlag has been activated !!!' >> ${StackFileLocation}/${StackFileName}
+      fi
 
       if [ X${ActivateBigBro} = Xtrue ] ; then
@@ -523,5 +508,8 @@
     else
       # Inform the stack file
-      echo "< ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/${StackFileName}
+      if [ X${ActivateStackFilling} = Xtrue ] ; then
+        echo "< ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/${StackFileName}
+      fi
+
       if [ X${ActivateBigBro} = Xtrue ] ; then
         # RabbitMQ message code "POPSTACK"
@@ -780,5 +768,7 @@
   instrumentationContent=$( echo "\"actionName\":\"${actionType}\",\"size_Mo\":\"${entitySizeMo}\",\"duration_ms\":\"${diff_ms}\",\"throughput_Mo_s\":\"${flux_Mo_s}\",\"dirFrom\":\"${dirFrom}\",\"dirTo\":\"${dirTo}\"" )
 
-  echo "{${instrumentationContent}}"
+  if [ X${ActivateStackFilling} = Xtrue ] ; then
+    echo "{${instrumentationContent}}" >> ${StackFileLocation}/${StackFileName}
+  fi
 
   # Inform the rabbitMQ queue
