Disabled logging alerts to syslog.

It feels to be causing more harm than good, because syslog() can be blocking,
which is even more critical under resource exhaustion conditions when some
alerts are expected.
This commit is contained in:
Valentin Bartenev
2021-03-24 08:05:07 +03:00
parent 175ef1c1db
commit b04832da84
2 changed files with 16 additions and 2 deletions

View File

@@ -19,7 +19,10 @@ static u_char *nxt_log_debug_time(u_char *buf, nxt_realtime_t *now,
void nxt_cdecl void nxt_cdecl
nxt_log_time_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...) nxt_log_time_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...)
{ {
u_char *p, *syslogmsg, *end; u_char *p, *end;
#if 0
u_char *syslogmsg;
#endif
va_list args; va_list args;
nxt_thread_t *thr; nxt_thread_t *thr;
nxt_time_string_t *time_cache; nxt_time_string_t *time_cache;
@@ -34,7 +37,9 @@ nxt_log_time_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...)
p = nxt_thread_time_string(thr, time_cache, msg); p = nxt_thread_time_string(thr, time_cache, msg);
#if 0
syslogmsg = p; syslogmsg = p;
#endif
#if 0 #if 0
nxt_fid_t fid; nxt_fid_t fid;
@@ -79,6 +84,7 @@ nxt_log_time_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...)
(void) nxt_write_console(nxt_stderr, msg, p - msg); (void) nxt_write_console(nxt_stderr, msg, p - msg);
#if 0
if (level == NXT_LOG_ALERT) { if (level == NXT_LOG_ALERT) {
*(p - nxt_length("\n")) = '\0'; *(p - nxt_length("\n")) = '\0';
@@ -88,6 +94,7 @@ nxt_log_time_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...)
*/ */
nxt_write_syslog(LOG_ALERT, syslogmsg); nxt_write_syslog(LOG_ALERT, syslogmsg);
} }
#endif
} }

View File

@@ -66,7 +66,10 @@ nxt_log_set_ctx(nxt_log_t *log, nxt_log_ctx_handler_t handler, void *ctx)
void nxt_cdecl void nxt_cdecl
nxt_log_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...) nxt_log_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...)
{ {
u_char *p, *syslogmsg, *end; u_char *p, *end;
#if 0
u_char *syslogmsg;
#endif
va_list args; va_list args;
u_char msg[NXT_MAX_ERROR_STR]; u_char msg[NXT_MAX_ERROR_STR];
@@ -79,7 +82,9 @@ nxt_log_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...)
*p++ = ' '; *p++ = ' ';
} }
#if 0
syslogmsg = p; syslogmsg = p;
#endif
p = nxt_sprintf(p, end, (log->ident != 0) ? "[%V] *%D " : "[%V] ", p = nxt_sprintf(p, end, (log->ident != 0) ? "[%V] *%D " : "[%V] ",
&nxt_log_levels[level], log->ident); &nxt_log_levels[level], log->ident);
@@ -100,6 +105,7 @@ nxt_log_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...)
(void) nxt_write_console(nxt_stderr, msg, p - msg); (void) nxt_write_console(nxt_stderr, msg, p - msg);
#if 0
if (level == NXT_LOG_ALERT) { if (level == NXT_LOG_ALERT) {
*(p - nxt_length("\n")) = '\0'; *(p - nxt_length("\n")) = '\0';
@@ -109,4 +115,5 @@ nxt_log_handler(nxt_uint_t level, nxt_log_t *log, const char *fmt, ...)
*/ */
nxt_write_syslog(LOG_ALERT, syslogmsg); nxt_write_syslog(LOG_ALERT, syslogmsg);
} }
#endif
} }