Commit d0b3925e authored by Geoff Simmons's avatar Geoff Simmons

refactored log levels used for types of information:

NOTICE: lifecycle events
INFO: monitoring logs and informational messages at startup
CRIT: fatal errors at startup
ERR: recoverable errors after startup
ALERT: fatal errors after startup
parent 77a06de3
......@@ -256,7 +256,7 @@ DATA_Dump(void)
logline_t *rec;
if (txn[i].magic != TX_MAGIC) {
LOG_Log(LOG_ALERT,
LOG_Log(LOG_ERR,
"Invalid tx at index %d, magic = 0x%08x, expected 0x%08x",
i, txn[i].magic, TX_MAGIC);
continue;
......@@ -277,7 +277,7 @@ DATA_Dump(void)
if (rec == NULL)
continue;
if (rec->magic != LOGLINE_MAGIC) {
LOG_Log(LOG_ALERT,
LOG_Log(LOG_ERR,
"Invalid record at tx %d, magic = 0x%08x, expected 0x%08x",
i, rec->magic, LOGLINE_MAGIC);
continue;
......@@ -288,7 +288,7 @@ DATA_Dump(void)
chunk_t *chunk = VSTAILQ_FIRST(&rec->chunks);
while (n > 0 && chunk != NULL) {
if (chunk->magic != CHUNK_MAGIC) {
LOG_Log(LOG_ALERT,
LOG_Log(LOG_ERR,
"Invalid chunk at tx %d, magic = 0x%08x, "
"expected 0x%08x",
i, chunk->magic, CHUNK_MAGIC);
......
/*-
* Copyright (c) 2013 UPLEX Nils Goroll Systemoptimierung
* Copyright (c) 2013 Otto Gmbh & Co KG
* Copyright (c) 2013-2015 UPLEX Nils Goroll Systemoptimierung
* Copyright (c) 2013-2015 Otto Gmbh & Co KG
* All rights reserved
* Use only with permission
*
......@@ -67,13 +67,13 @@ monitor_cleanup(void *arg)
(void) arg;
log_output();
LOG_Log0(LOG_INFO, "Monitoring thread exiting");
LOG_Log0(LOG_NOTICE, "Monitoring thread exiting");
}
static void *
monitor_main(void *arg)
{
LOG_Log(LOG_INFO, "Monitor thread running every %u secs",
LOG_Log(LOG_NOTICE, "Monitor thread running every %u secs",
config.monitor_interval);
run = 1;
......@@ -85,7 +85,7 @@ monitor_main(void *arg)
}
pthread_cleanup_pop(0);
LOG_Log0(LOG_INFO, "Monitoring thread exiting");
LOG_Log0(LOG_NOTICE, "Monitoring thread exiting");
pthread_exit((void *) NULL);
}
......
......@@ -23,7 +23,7 @@ fi
# predictable from one run to the next.
CKSUM=$( sed -e 's/\(initializing\) \(.*\)/\1/' $LOG | egrep -v 'Writer: returned|Reader: took|^DEBUG: Allocating' | cksum )
if [ "$CKSUM" != '1684260647 69263259' ]; then
if [ "$CKSUM" != '1056349365 69263269' ]; then
echo "ERROR: Regression test varnishevent log incorrect cksum: $CKSUM"
exit 1
fi
......
......@@ -102,7 +102,7 @@ static unsigned long seen = 0, submitted = 0, len_overflows = 0, no_free_tx = 0,
#define SIGDISP(SIG, action) \
do { if (UNDEFINED(SIG)) break; \
if (sigaction((SIG), (&action), NULL) != 0) \
LOG_Log(LOG_ALERT, \
LOG_Log(LOG_ERR, \
"Cannot install handler for " #SIG ": %s", \
strerror(errno)); \
} while(0)
......@@ -589,7 +589,7 @@ main(int argc, char *argv[])
LOG_SetLevel(LOG_DEBUG);
}
LOG_Log(LOG_INFO, "initializing (%s)", version);
LOG_Log(LOG_NOTICE, "initializing (%s)", version);
if (pfh != NULL) {
errno = 0;
......@@ -709,7 +709,7 @@ main(int argc, char *argv[])
VAS_Fail = assert_fail;
if (FMT_Init(scratch) != 0) {
LOG_Log(LOG_ALERT, "Error in output formats: %s", scratch);
LOG_Log(LOG_CRIT, "Error in output formats: %s", scratch);
exit(EXIT_FAILURE);
}
......@@ -742,7 +742,7 @@ main(int argc, char *argv[])
assert(VSL_Arg(vsl, 'b', scratch) > 0);
if ((errnum = DATA_Init()) != 0) {
LOG_Log(LOG_ALERT, "Cannot init data tables: %s\n",
LOG_Log(LOG_CRIT, "Cannot init data tables: %s\n",
strerror(errnum));
exit(EXIT_FAILURE);
}
......@@ -756,7 +756,7 @@ main(int argc, char *argv[])
LOG_Log0(LOG_INFO, "Monitoring thread not running");
if ((errnum = WRT_Init()) != 0) {
LOG_Log(LOG_ALERT, "Cannot init writer thread: %s\n", strerror(errnum));
LOG_Log(LOG_CRIT, "Cannot init writer thread: %s\n", strerror(errnum));
exit(EXIT_FAILURE);
}
......@@ -787,7 +787,7 @@ main(int argc, char *argv[])
int wrt_waits = 0;
while (!WRT_Running()) {
if (wrt_waits++ > 10) {
LOG_Log0(LOG_ALERT, "Writer thread not running, giving up");
LOG_Log0(LOG_CRIT, "Writer thread not running, giving up");
exit(EXIT_FAILURE);
}
VTIM_sleep(1);
......@@ -820,7 +820,7 @@ main(int argc, char *argv[])
break;
case DISPATCH_EOF:
term = 1;
LOG_Log0(LOG_INFO, "Reached end of file");
LOG_Log0(LOG_NOTICE, "Reached end of file");
break;
case DISPATCH_CLOSED:
flush = 1;
......@@ -898,7 +898,7 @@ main(int argc, char *argv[])
LOG_Log(LOG_ERR, "Could not remove pid file %s: %s", P_arg,
strerror(errno));
}
LOG_Log0(LOG_INFO, "Exiting");
LOG_Log0(LOG_NOTICE, "Exiting");
LOG_Close();
exit(EXIT_SUCCESS);
......
......@@ -173,7 +173,7 @@ wrt_write(tx_t *tx)
AZ(pthread_mutex_lock(&reopen_lock));
if (reopen && fo != stdout) {
if (fflush(fo) != 0)
LOG_Log(LOG_ALERT, "Cannot flush to %s, DATA DISCARDED: %s",
LOG_Log(LOG_ERR, "Cannot flush to %s, DATA DISCARDED: %s",
config.output_file, strerror(errno));
if (fclose(fo) != 0) {
LOG_Log(LOG_ALERT, "Cannot close %s, exiting: %s",
......@@ -197,7 +197,7 @@ wrt_write(tx_t *tx)
if (timeout != NULL)
to = config.output_timeout;
if ((errnum = select(fd + 1, NULL, &set, NULL, timeout)) == -1) {
LOG_Log(LOG_ALERT,
LOG_Log(LOG_ERR,
"Error waiting for ready output %d (%s), DATA DISCARDED: %s",
errno, strerror(errno), VSB_data(os));
errors++;
......@@ -209,7 +209,7 @@ wrt_write(tx_t *tx)
}
}
else if (errnum == 0) {
LOG_Log(LOG_ALERT,
LOG_Log(LOG_ERR,
"Timeout waiting for ready output, DATA DISCARDED: %s",
VSB_data(os));
timeouts++;
......@@ -224,7 +224,7 @@ wrt_write(tx_t *tx)
else if (!FD_ISSET(fd, &set))
WRONG("Wrong file descriptor found ready for output");
else if (fprintf(fo, "%s", VSB_data(os)) < 0) {
LOG_Log(LOG_ALERT, "Output error %d (%s), DATA DISCARDED: %s",
LOG_Log(LOG_ERR, "Output error %d (%s), DATA DISCARDED: %s",
errno, strerror(errno), VSB_data(os));
errors++;
}
......@@ -247,7 +247,7 @@ static void
writer_data_t *wrt = (writer_data_t *) arg;
tx_t *tx;
LOG_Log0(LOG_INFO, "Writer thread starting");
LOG_Log0(LOG_NOTICE, "Writer thread starting");
CHECK_OBJ_NOTNULL(wrt, WRITER_DATA_MAGIC);
wrt->state = WRT_INITIALIZING;
......@@ -271,7 +271,7 @@ static void
* flush ouput and return space before sleeping
*/
if (fflush(fo) != 0) {
LOG_Log(LOG_ALERT, "Output flush failed, error %d (%s)",
LOG_Log(LOG_ERR, "Output flush failed, error %d (%s)",
errno, strerror(errno));
errors++;
}
......@@ -299,13 +299,13 @@ static void
wrt_write(tx);
}
if (fflush(fo) != 0) {
LOG_Log(LOG_ALERT, "Output flush failed, error %d (%s)",
LOG_Log(LOG_ERR, "Output flush failed, error %d (%s)",
errno, strerror(errno));
errors++;
}
wrt->status = EXIT_SUCCESS;
LOG_Log0(LOG_INFO, "Writer thread exiting");
LOG_Log0(LOG_NOTICE, "Writer thread exiting");
wrt->state = WRT_EXITED;
pthread_exit((void *) wrt);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment