nghttpx: Add logging for somewhat important events (logs, tickets, and ocsp)

This commit is contained in:
Tatsuhiro Tsujikawa 2015-04-11 00:08:28 +09:00
parent 14d4979c54
commit 889e705f35
3 changed files with 24 additions and 24 deletions

View File

@ -417,9 +417,7 @@ namespace {
void reopen_log_signal_cb(struct ev_loop *loop, ev_signal *w, int revents) {
auto conn_handler = static_cast<ConnectionHandler *>(w->data);
if (LOG_ENABLED(INFO)) {
LOG(INFO) << "Reopening log files: main";
}
LOG(NOTICE) << "Reopening log files: main";
(void)reopen_log_files();
redirect_stderr_to_errorlog();
@ -573,9 +571,8 @@ void renew_ticket_key_cb(struct ev_loop *loop, ev_timer *w, int revents) {
const auto &old_ticket_keys = conn_handler->get_ticket_keys();
auto ticket_keys = std::make_shared<TicketKeys>();
if (LOG_ENABLED(INFO)) {
LOG(INFO) << "renew ticket key";
}
LOG(NOTICE) << "Renew ticket keys: main";
// We store at most 2 ticket keys
if (old_ticket_keys) {
auto &old_keys = old_ticket_keys->keys;

View File

@ -69,6 +69,8 @@ void ocsp_cb(struct ev_loop *loop, ev_timer *w, int revent) {
return;
}
LOG(NOTICE) << "Start ocsp update";
h->proceed_next_cert_ocsp();
}
} // namespace
@ -358,6 +360,10 @@ int ConnectionHandler::start_ocsp_update(const char *cert_file) {
int rv;
int pfd[2];
if (LOG_ENABLED(INFO)) {
LOG(INFO) << "Start ocsp update for " << cert_file;
}
assert(!ev_is_active(&ocsp_.rev));
assert(!ev_is_active(&ocsp_.chldev));
@ -391,8 +397,8 @@ int ConnectionHandler::start_ocsp_update(const char *cert_file) {
auto pid = fork();
if (pid == -1) {
auto error = errno;
LOG(WARN) << "Could not execute ocsp query command: " << argv[0]
<< ", fork() failed, errno=" << error;
LOG(WARN) << "Could not execute ocsp query command for " << cert_file
<< ": " << argv[0] << ", fork() failed, errno=" << error;
return -1;
}
@ -461,22 +467,23 @@ void ConnectionHandler::handle_ocsp_complete() {
ev_io_stop(loop_, &ocsp_.rev);
ev_child_stop(loop_, &ocsp_.chldev);
auto rstatus = ocsp_.chldev.rstatus;
auto status = WEXITSTATUS(rstatus);
if (ocsp_.error || !WIFEXITED(rstatus) || status != 0) {
LOG(WARN) << "ocsp query command failed: error=" << ocsp_.error
<< ", rstatus=" << rstatus << ", status=" << status;
++ocsp_.next;
proceed_next_cert_ocsp();
return;
}
assert(ocsp_.next < all_ssl_ctx_.size());
auto ssl_ctx = all_ssl_ctx_[ocsp_.next];
auto tls_ctx_data =
static_cast<ssl::TLSContextData *>(SSL_CTX_get_app_data(ssl_ctx));
auto rstatus = ocsp_.chldev.rstatus;
auto status = WEXITSTATUS(rstatus);
if (ocsp_.error || !WIFEXITED(rstatus) || status != 0) {
LOG(WARN) << "ocsp query command for " << tls_ctx_data->cert_file
<< " failed: error=" << ocsp_.error << ", rstatus=" << rstatus
<< ", status=" << status;
++ocsp_.next;
proceed_next_cert_ocsp();
return;
}
if (LOG_ENABLED(INFO)) {
LOG(INFO) << "ocsp update for " << tls_ctx_data->cert_file
<< " finished successfully";

View File

@ -160,17 +160,13 @@ void Worker::process_events() {
break;
}
case RENEW_TICKET_KEYS:
if (LOG_ENABLED(INFO)) {
WLOG(INFO, this) << "Renew ticket keys: worker(" << this << ")";
}
WLOG(NOTICE, this) << "Renew ticket keys: worker(" << this << ")";
ticket_keys_ = wev.ticket_keys;
break;
case REOPEN_LOG:
if (LOG_ENABLED(INFO)) {
WLOG(INFO, this) << "Reopening log files: worker(" << this << ")";
}
WLOG(NOTICE, this) << "Reopening log files: worker(" << this << ")";
reopen_log_files();