You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by we...@apache.org on 2020/02/16 03:44:10 UTC

[incubator-apisix] branch master updated: bugfix: allow write debug log even if the openresty disabled debug model (#1124)

This is an automated email from the ASF dual-hosted git repository.

wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new c881c04  bugfix: allow write debug log even if the openresty disabled debug model (#1124)
c881c04 is described below

commit c881c04368350d808a0bb6c4ce1d97927ebdef4b
Author: YuanSheng Wang <me...@gmail.com>
AuthorDate: Sun Feb 16 11:44:01 2020 +0800

    bugfix: allow write debug log even if the openresty disabled debug model (#1124)
    
    fix https://github.com/apache/incubator-apisix/pull/1121#discussion_r378760095
---
 .gitignore              | 1 +
 lua/apisix/core/log.lua | 5 +----
 t/core/log.t            | 4 ++++
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index 880525d..c95899a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -56,6 +56,7 @@ client_body_temp
 utils/lj-releng
 .idea/
 *.iml
+dashboard/
 
 # .travis
 !.travis/*.sh
diff --git a/lua/apisix/core/log.lua b/lua/apisix/core/log.lua
index 902b88f..59791d6 100644
--- a/lua/apisix/core/log.lua
+++ b/lua/apisix/core/log.lua
@@ -16,8 +16,6 @@
 --
 local ngx = ngx
 local ngx_log  = ngx.log
-local ngx_DEBUG= ngx.DEBUG
-local DEBUG    = ngx.config.debug
 local require  = require
 
 
@@ -44,8 +42,7 @@ setmetatable(_M, {__index = function(self, cmd)
     local log_level = log_levels[cmd]
 
     local method
-    if cur_level and (log_level > cur_level or
-        (log_level == ngx_DEBUG and not DEBUG))
+    if cur_level and (log_level > cur_level)
     then
         method = do_nothing
     else
diff --git a/t/core/log.t b/t/core/log.t
index 2754174..0660c04 100644
--- a/t/core/log.t
+++ b/t/core/log.t
@@ -57,6 +57,7 @@ info log
             core.log.warn("warn log")
             core.log.notice("notice log")
             core.log.info("info log")
+            core.log.debug("debug log")
             ngx.say("done")
         }
     }
@@ -69,6 +70,7 @@ warn log
 --- no_error_log
 notice log
 info log
+debug log
 
 
 
@@ -81,6 +83,7 @@ info log
             core.log.warn("warn log")
             core.log.notice("notice log")
             core.log.info("info log")
+            core.log.debug("debug log")
             ngx.say("done")
         }
     }
@@ -93,6 +96,7 @@ warn log
 notice log
 --- no_error_log
 info log
+debug log