summaryrefslogtreecommitdiff
path: root/src/log.c
diff options
context:
space:
mode:
authorMukund Sivaraman <muks@banu.com>2010-01-17 14:27:49 +0530
committerMukund Sivaraman <muks@banu.com>2010-01-17 14:27:49 +0530
commit9c68b941366a02885d258ea76466ac34aa7ecb13 (patch)
treeb323d09e9f70b9751b54565b8b2193b1505dea03 /src/log.c
parent26b4ab07a41eabbfab74bb3c8d76a23e34d16919 (diff)
downloadtinyproxy-9c68b941366a02885d258ea76466ac34aa7ecb13.tar.gz
tinyproxy-9c68b941366a02885d258ea76466ac34aa7ecb13.zip
Do an openlog() on fallback to syslog
Diffstat (limited to '')
-rw-r--r--src/log.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/log.c b/src/log.c
index 365df54..6b5db55 100644
--- a/src/log.c
+++ b/src/log.c
@@ -248,14 +248,7 @@ void send_stored_logs (void)
*/
int setup_logging (void)
{
- /* Write to a user supplied log file if it's defined. This will
- * override using the syslog even if syslog is defined. */
- if (config.syslog) {
- if (config.godaemon == TRUE)
- openlog ("tinyproxy", LOG_PID, LOG_DAEMON);
- else
- openlog ("tinyproxy", LOG_PID, LOG_USER);
- } else {
+ if (!config.syslog) {
if (open_log_file (config.logf_name) < 0) {
/*
* If opening the log file fails, we try
@@ -268,11 +261,16 @@ int setup_logging (void)
config.logf_name, strerror (errno));
log_message (LOG_CRIT,
"Falling back to syslog logging\n");
- } else {
- config.syslog = FALSE;
}
}
+ if (config.syslog) {
+ if (config.godaemon == TRUE)
+ openlog ("tinyproxy", LOG_PID, LOG_DAEMON);
+ else
+ openlog ("tinyproxy", LOG_PID, LOG_USER);
+ }
+
logging_initialized = TRUE;
send_stored_logs ();