shutdown_error_log
检查 Nginx 关闭阶段的错误日志内容。
语法
--- shutdown_error_log 段专门检查 Nginx 在关闭(shutdown)阶段写入的日志。这些日志发生在请求处理完成之后、进程退出之前。常用于检查 worker 退出时的 timer、cleanup handler 等行为。
perl
1=== TEST 1: check shutdown log2--- config3 location /t {4 content_by_lua_block {5 local function cleanup()6 ngx.log(ngx.NOTICE, "cleanup done")7 end8 ngx.timer.at(0, cleanup)9 ngx.say("ok")10 }11 }12--- request13GET /t14--- shutdown_error_log15cleanup doneshutdown_error_log 对于验证 timer 回调、shared dict 清理等异步操作在进程退出时的行为非常重要。