Opened 6 years ago
Closed 6 years ago
#1698 closed enhancement (invalid)
A minor optimization for ngx_log_debug
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-core | Version: | 1.15.x |
Keywords: | ngx_log_debug | Cc: | |
uname -a: | |||
nginx -V: | nginx version: nginx/1.15.6 |
Description
In ngx_log_debug, it will compare log_level and level use '&',but if we compose multi levels it will case a compiler error (suggest parentheses around arithmetic in operand of ‘|’).
For example :
ngx_log_debug2(
NGX_LOG_DEBUG_HTTP|NGX_LOG_DEBUG_CONNECTION,...)
this code will be:
log->log_level & NGX_LOG_DEBUG_HTTP|NGX_LOG_DEBUG_CONNECTION
So I think we should add parentheses around 'level' in macro.
Please check the patch,Thanks all of you, nginx team.
(by the way, I can not config hg's emailbomb, please forgive my behavior)
Attachments (2)
Change History (4)
by , 6 years ago
Attachment: | ngx_log.c.patch added |
---|
by , 6 years ago
Attachment: | ngx_log.h.patch added |
---|
comment:1 by , 6 years ago
comment:2 by , 6 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
You are not expected to use more than one level in ngx_log_debugN() calls. In particular, the NGX_LOG_DEBUG_CONNECTION macro is to be used in the log->log_level to indicate that debug logging was requested via the debug_connection
directive and should not be switched off by configuration-specific logging. Using it in a ngx_log_debugN(() call is clearly an error.
sorry for the wrong patch filename ,I have uploaded the right 'ngx_log.h.patch', please ignore 'ngx_log.c.patch'.