diff --git a/DDDB/src/CondDB2DDDB.cpp b/DDDB/src/CondDB2DDDB.cpp
index 78d27ea75c4d9caead77a4df9690cc71ed262d80..ff9e138fab19ffc1e3e1c4b30a8b6b812ec42958 100644
--- a/DDDB/src/CondDB2DDDB.cpp
+++ b/DDDB/src/CondDB2DDDB.cpp
@@ -38,7 +38,6 @@ namespace DD4hep {
   /// Keep all in here anonymous. Does not have to be visible outside.
   namespace {
 
-    static int preserv_level = 0;
     using Conditions::Condition;
     using Conditions::AbstractMap;
 
@@ -109,27 +108,30 @@ namespace DD4hep {
           return *this;
         }
       };
+
       /// Helper class to preserve local processing environment
       /**   \ingroup DD4HEP_DDDB
        */
       class PreservedLocals : public Locals {
       public:
         Context* context;
-        PreservedLocals(Context* c) : Locals(c->locals), context(c) {
 #ifdef __DEBUG_LOCALS
+        void print(const char* opt, bool inc)  const  {
+          static int preserv_level = 0;
+          int level = inc ? preserv_level++ : --preserv_level;
           if ( xml_doc )
-            printout(INFO,"Locals","PUSH[%d]: %s [%s]", preserv_level++, obj_path.c_str(), xml_doc->id.c_str());
+            printout(INFO,"Locals","%s[%d]: %s [%s]", opt, level, obj_path.c_str(), xml_doc->id.c_str());
           else
-            printout(INFO,"Locals","PUSH[%d]: %s ", preserv_level++, obj_path.c_str());
+            printout(INFO,"Locals","%s[%d]: %s ", opt, level, obj_path.c_str());
+        }
+#else
+        inline void print(const char*, bool) const {}
 #endif
+        PreservedLocals(Context* c) : Locals(c->locals), context(c) {
+          print("PUSH", true);
         }
         ~PreservedLocals()           {
-#ifdef __DEBUG_LOCALS
-          if ( xml_doc )
-            printout(INFO,"Locals","POP [%d]: %s [%s]", --preserv_level, obj_path.c_str(), xml_doc->id.c_str());
-          else
-            printout(INFO,"Locals","POP [%d]: %s", --preserv_level, obj_path.c_str());
-#endif
+          print("POP ", false);
           context->locals = *this; 
         }
       };
diff --git a/DDG4/include/DDG4/IoStreams.h b/DDG4/include/DDG4/IoStreams.h
index 716dadee85aad77ded721115681d02b92a0a7d47..b221f75c957ae3c89f01b470cf49fae5f3e05bc2 100644
--- a/DDG4/include/DDG4/IoStreams.h
+++ b/DDG4/include/DDG4/IoStreams.h
@@ -17,14 +17,21 @@
 // C/C++ include files
 #include <string>
 
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow" // Code that causes warning goes here
+#endif
+
 // booost iostreams include files
 #include <boost/iostreams/categories.hpp>
 #include <boost/iostreams/detail/ios.hpp>
 #include <boost/iostreams/detail/path.hpp>
 #include <boost/iostreams/positioning.hpp>
 
+// Forward declarations
 class TFile;
 
+/// Namespace for the AIDA detector description toolkit
 namespace DD4hep {
 
   // Forward declarations
@@ -227,4 +234,10 @@ namespace DD4hep {
     {  open(detail_path(path), mode);                     }
   };
 }   // End namespace boost
+
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
 #endif // DD4HEP_DD4HEP_IOSTREAMs_H