diff --git a/src/ngx_pagespeed.cc b/src/ngx_pagespeed.cc index 8645694e4..139531032 100644 --- a/src/ngx_pagespeed.cc +++ b/src/ngx_pagespeed.cc @@ -983,6 +983,7 @@ void* ps_create_main_conf(ngx_conf_t* cf) { "" /* hostname, not used */, -1 /* port, not used */); active_driver_factory = cfg_m->driver_factory; + active_driver_factory->LoggingInit(ngx_cycle->log, false); cfg_m->driver_factory->Init(); ps_set_conf_cleanup_handler(cf, ps_cleanup_main_conf, cfg_m); return cfg_m; @@ -3044,7 +3045,7 @@ ngx_int_t ps_init_module(ngx_cycle_t* cycle) { return NGX_ERROR; } - cfg_m->driver_factory->LoggingInit(cycle->log); + cfg_m->driver_factory->LoggingInit(cycle->log, true); cfg_m->driver_factory->RootInit(); } else { delete cfg_m->driver_factory; @@ -3076,7 +3077,7 @@ ngx_int_t ps_init_child_process(ngx_cycle_t* cycle) { // ChildInit() will initialise all ServerContexts, which we need to // create ProxyFetchFactories below - cfg_m->driver_factory->LoggingInit(cycle->log); + cfg_m->driver_factory->LoggingInit(cycle->log, true); cfg_m->driver_factory->ChildInit(); ngx_http_core_main_conf_t* cmcf = static_cast( diff --git a/src/ngx_rewrite_driver_factory.cc b/src/ngx_rewrite_driver_factory.cc index a144d05e3..3648b1f60 100644 --- a/src/ngx_rewrite_driver_factory.cc +++ b/src/ngx_rewrite_driver_factory.cc @@ -208,10 +208,11 @@ void NgxRewriteDriverFactory::StartThreads() { threads_started_ = true; } -void NgxRewriteDriverFactory::LoggingInit(ngx_log_t* log) { +void NgxRewriteDriverFactory::LoggingInit( + ngx_log_t* log, bool may_install_crash_handler) { log_ = log; net_instaweb::log_message_handler::Install(log); - if (install_crash_handler()) { + if (may_install_crash_handler && install_crash_handler()) { NgxMessageHandler::InstallCrashHandler(log); } ngx_message_handler_->set_log(log); diff --git a/src/ngx_rewrite_driver_factory.h b/src/ngx_rewrite_driver_factory.h index 54ff3bf28..0d7b210e5 100644 --- a/src/ngx_rewrite_driver_factory.h +++ b/src/ngx_rewrite_driver_factory.h @@ -115,7 +115,7 @@ class NgxRewriteDriverFactory : public SystemRewriteDriverFactory { return process_script_variables_; } - void LoggingInit(ngx_log_t* log); + void LoggingInit(ngx_log_t* log, bool may_install_crash_handler); virtual void ShutDownMessageHandlers();