summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-01-17 01:10:21 +0100
committerMichael Adam <obnox@samba.org>2010-01-17 01:10:21 +0100
commit807002364388a559214cae00139bb2446370bc72 (patch)
tree84faf793da2dbbe6a9f3eae974aa0f1b45027c8f /src
parent54a613b9db74e71af8e4083f639a039a4d7853a1 (diff)
log: when opening the log file fails, fall back to syslog logging.
Diffstat (limited to 'src')
-rw-r--r--src/log.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/log.c b/src/log.c
index edb709f..94d3872 100644
--- a/src/log.c
+++ b/src/log.c
@@ -259,11 +259,20 @@ int setup_logging (void)
openlog ("tinyproxy", LOG_PID, LOG_USER);
} else {
if (open_log_file (config.logf_name) < 0) {
- fprintf (stderr,
- "%s: Could not create log file.\n", PACKAGE);
- goto done;
+ /*
+ * If opening the log file fails, we try
+ * to fall back to syslog logging...
+ */
+ config.syslog = TRUE;
+
+ log_message (LOG_CRIT, "ERROR: Could not create log "
+ "file %s: %s.\n", PACKAGE,
+ config.logf_name, strerror (errno));
+ log_message (LOG_CRIT,
+ "Falling back to syslog logging\n");
+ } else {
+ config.syslog = FALSE;
}
- config.syslog = FALSE; /* disable syslog */
}
logging_initialized = TRUE;