diff --git a/macro/PWG/common/production/run_analysis_tree_maker_json_config.C b/macro/PWG/common/production/run_analysis_tree_maker_json_config.C
index 86b8e56b754eb860ea4d446de2b9ba0ae54efba0..5cccd6a476b29821d4564f86b8534fa022f2c213 100644
--- a/macro/PWG/common/production/run_analysis_tree_maker_json_config.C
+++ b/macro/PWG/common/production/run_analysis_tree_maker_json_config.C
@@ -3,12 +3,11 @@
    Authors: Viktor Klochkov, Frederic Linz [committer] */
 
 // -----   Check output file name   -------------------------------------------
-bool CheckOutFileName(TString fileName, Bool_t overwrite)
+bool CheckOutFileName(TString fileName, Bool_t overwrite, const char* caller = __builtin_FUNCTION())
 {
-  string fName = "run_analysis_tree_maker_json_config";
   // --- Protect against overwriting an existing file
   if ((!gSystem->AccessPathName(fileName.Data())) && (!overwrite)) {
-    cout << fName << ": output file " << fileName << " already exists!";
+    std::cout << caller << ": output file " << fileName << " already exists!" << std::endl;
     return false;
   }
 
@@ -17,11 +16,11 @@ bool CheckOutFileName(TString fileName, Bool_t overwrite)
   if (gSystem->AccessPathName(directory)) {
     Int_t success = gSystem->mkdir(directory, kTRUE);
     if (success == -1) {
-      cout << fName << ": output directory " << directory << " does not exist and cannot be created!";
+      std::cout << caller << ": output directory " << directory << " does not exist and cannot be created!" << std::endl;
       return false;
     }
     else
-      cout << fName << ": created directory " << directory;
+      std::cout << caller << ": created directory " << directory << std::endl;
   }
   return true;
 }
diff --git a/macro/PWG/common/production/run_reco_json_config.C b/macro/PWG/common/production/run_reco_json_config.C
index cd57175dd91c87b214a56de13ae6b03e757d9ca0..93c645ff73f1ca4a54e1c747fdd6447ae98c13f3 100644
--- a/macro/PWG/common/production/run_reco_json_config.C
+++ b/macro/PWG/common/production/run_reco_json_config.C
@@ -92,12 +92,11 @@
  **/
 
 // -----   Check output file name   -------------------------------------------
-bool CheckOutFileName(TString fileName, Bool_t overwrite)
+bool CheckOutFileName(TString fileName, Bool_t overwrite, const char* caller = __builtin_FUNCTION())
 {
-  string fName = "run_reco_json_config";
   // --- Protect against overwriting an existing file
   if ((!gSystem->AccessPathName(fileName.Data())) && (!overwrite)) {
-    cout << fName << ": output file " << fileName << " already exists!";
+    std::cout << caller << ": output file " << fileName << " already exists!" << std::endl;
     return false;
   }
 
@@ -106,11 +105,11 @@ bool CheckOutFileName(TString fileName, Bool_t overwrite)
   if (gSystem->AccessPathName(directory)) {
     Int_t success = gSystem->mkdir(directory, kTRUE);
     if (success == -1) {
-      cout << fName << ": output directory " << directory << " does not exist and cannot be created!";
+      std::cout << caller << ": output directory " << directory << " does not exist and cannot be created!" << std::endl;
       return false;
     }
     else
-      cout << fName << ": created directory " << directory;
+      std::cout << caller << ": created directory " << directory << std::endl;
   }
   return true;
 }