log_level

设置当前测试块的 Nginx 错误日志级别。

语法

--- log_level 段为当前测试块设置 error_log 的日志级别。默认是 debug。可选值为 Nginx 支持的日志级别:debuginfonoticewarnerrorcritalertemerg

perl
1=== TEST 1: warn level only
2--- log_level: warn
3--- config
4 location /t {
5 content_by_lua_block {
6 ngx.log(ngx.INFO, "this will not appear")
7 ngx.log(ngx.WARN, "this will appear")
8 ngx.say("ok")
9 }
10 }
11--- request
12GET /t
13--- error_log
14this will appear
15--- no_error_log
16this will not appear

调试时可以临时设为 debug 获取更多信息;在性能测试中设为 warn 或更高以减少 I/O 开销。