Skip to content

Commit

Permalink
bugfix: allow write debug log even if the openresty disabled debug mo…
Browse files Browse the repository at this point in the history
…del (#1124)

fix #1121 (comment)
  • Loading branch information
membphis committed Feb 16, 2020
1 parent 0600525 commit c881c04
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ client_body_temp
utils/lj-releng
.idea/
*.iml
dashboard/

# .travis
!.travis/*.sh
5 changes: 1 addition & 4 deletions lua/apisix/core/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions t/core/log.t
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Expand All @@ -69,6 +70,7 @@ warn log
--- no_error_log
notice log
info log
debug log
Expand All @@ -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")
}
}
Expand All @@ -93,6 +96,7 @@ warn log
notice log
--- no_error_log
info log
debug log
Expand Down

0 comments on commit c881c04

Please sign in to comment.