diff --git a/indra/llcommon/llcallstack.h b/indra/llcommon/llcallstack.h
index 5acf04a49fa16c4355f112fc1e0047f5d5222009..b12b561985768d1397acdac9db4b8eb886a182a3 100644
--- a/indra/llcommon/llcallstack.h
+++ b/indra/llcommon/llcallstack.h
@@ -80,7 +80,8 @@ struct LLContextStatus
 LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status);
 
 #define dumpStack(tag) \
-    if (debugLoggingEnabled(tag)) \
+    static const bool enable_log = debugLoggingEnabled(tag); \
+    if (enable_log) \
     { \
         LLCallStack cs; \
         LL_DEBUGS(tag) << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL; \
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 45d2128a1c708cf1e241ebfff268e75329c3eec2..a78c248c33eeb818788a214ae30c1a03bec27a3d 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1517,7 +1517,8 @@ BOOL LLVOVolume::updateLOD()
 
 	if (lod_changed)
 	{
-        if (debugLoggingEnabled("AnimatedObjectsLinkset"))
+		static const bool enable_log = debugLoggingEnabled("AnimatedObjectsLinkset");
+        if (enable_log)
         {
             if (isAnimatedObject() && isRiggedMesh())
             {
@@ -4452,7 +4453,8 @@ const LLMatrix4& LLVOVolume::getWorldMatrix(LLXformMatrix* xform) const
 
 void LLVOVolume::markForUpdate(BOOL priority)
 { 
-    if (debugLoggingEnabled("AnimatedObjectsLinkset"))
+	static const bool enable_log = debugLoggingEnabled("AnimatedObjectsLinkset");
+    if (enable_log)
     {
         if (isAnimatedObject() && isRiggedMesh())
         {
@@ -6063,7 +6065,8 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
 			if (drawablep && !drawablep->isDead() && drawablep->isState(LLDrawable::REBUILD_ALL) && !drawablep->isState(LLDrawable::RIGGED) )
 			{
 				LLVOVolume* vobj = drawablep->getVOVolume();
-                if (debugLoggingEnabled("AnimatedObjectsLinkset"))
+				static const bool enable_log = debugLoggingEnabled("AnimatedObjectsLinkset");
+                if (enable_log)
                 {
                     if (vobj->isAnimatedObject() && vobj->isRiggedMesh())
                     {
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 1ac71d265921660ccf9bc6e11c743ad4822ee041..9e816a7b3bda64d8def406bf8e8ebe0cb9c947ad 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -3355,7 +3355,8 @@ void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags f
 {
 	if (drawablep && !drawablep->isDead() && assertInitialized())
 	{
-        if (debugLoggingEnabled("AnimatedObjectsLinkset"))
+		static const bool enable_log = debugLoggingEnabled("AnimatedObjectsLinkset");
+        if (enable_log)
         {
             LLVOVolume *vol_obj = drawablep->getVOVolume();
             if (vol_obj && vol_obj->isAnimatedObject() && vol_obj->isRiggedMesh())