diff --git a/src/helper/log.c b/src/helper/log.c
index 27fa8317aa6e0526037257affc9e14d1a3a8ddfa..3067ecc56180fadcdbbc797c784cdecb0147eceb 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -346,6 +346,19 @@ void log_init(void)
 	if (debug_level == -1)
 		debug_level = LOG_LVL_INFO;
 
+	char *debug_env = getenv("OPENOCD_DEBUG_LEVEL");
+	if (NULL != debug_env)
+	{
+		int value;
+		int retval = parse_int(debug_env, &value);
+		if (ERROR_OK == retval &&
+				debug_level >= LOG_LVL_SILENT &&
+				debug_level <= LOG_LVL_DEBUG)
+		{
+			debug_level = value;
+		}
+	}
+
 	if (log_output == NULL)
 		log_output = stderr;