diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index c0edd92bc117421a3501d71cd992f2f901c6cce8..c2e9740372462786649459c6abb54da3caf27714 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -1047,6 +1047,33 @@ void flush_glerror()
 	glGetError();
 }
 
+//this function outputs gl error to the log file, does not crash the code.
+void log_glerror()
+{
+	if (LL_UNLIKELY(!gGLManager.mInited))
+	{
+		return ;
+	}
+	//  Create or update texture to be used with this data 
+	GLenum error;
+	error = glGetError();
+	while (LL_UNLIKELY(error))
+	{
+		GLubyte const * gl_error_msg = gluErrorString(error);
+		if (NULL != gl_error_msg)
+		{
+			llwarns << "GL Error: " << error << " GL Error String: " << gl_error_msg << llendl ;			
+		}
+		else
+		{
+			// gluErrorString returns NULL for some extensions' error codes.
+			// you'll probably have to grep for the number in glext.h.
+			llwarns << "GL Error: UNKNOWN 0x" << std::hex << error << std::dec << llendl;
+		}
+		error = glGetError();
+	}
+}
+
 void do_assert_glerror()
 {
 	if (LL_UNLIKELY(!gGLManager.mInited))
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index 5e8965c06add464aa3d5bdedd1d39642ccf9b704..de63d37480ca80f28e98d6dab02446f421b8f947 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -157,6 +157,7 @@ void rotate_quat(LLQuaternion& rotation);
 
 void flush_glerror(); // Flush GL errors when we know we're handling them correctly.
 
+void log_glerror();
 void assert_glerror();
 
 void clear_glerror();