From 87335def6719cc7eb10a7cfeea8cf66c34eca1fc Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 12 Jun 2008 21:59:27 +0000 Subject: Default --log-output to syslog in --daemon mode. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@667253 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpidd.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'qpid/cpp/src/qpidd.cpp') diff --git a/qpid/cpp/src/qpidd.cpp b/qpid/cpp/src/qpidd.cpp index 23781ead2c..0194f9af23 100644 --- a/qpid/cpp/src/qpidd.cpp +++ b/qpid/cpp/src/qpidd.cpp @@ -80,7 +80,7 @@ struct DaemonOptions : public qpid::Options { piddir += "/.qpidd"; addOptions() - ("daemon,d", optValue(daemon), "Run as a daemon.") + ("daemon,d", optValue(daemon), "Run as a daemon. --log-output defaults to syslog in this mode.") ("pid-dir", optValue(piddir, "DIR"), "Directory where port-specific PID file is stored") ("wait,w", optValue(wait, "SECONDS"), "Sets the maximum wait time to initialize the daemon. If the daemon fails to initialize, prints an error and returns 1") ("check,c", optValue(check), "Prints the daemon's process ID to stdout and returns 0 if the daemon is running, otherwise returns 1") @@ -124,7 +124,7 @@ struct QpiddOptions : public qpid::Options { struct BootstrapOptions : public qpid::Options { CommonOptions common; ModuleOptions module; - qpid::log::Options log; + qpid::log::Options log; BootstrapOptions(const char* argv0) : qpid::Options("Options"), common("", "/etc/qpidd.conf"), log(argv0) { add(common); @@ -258,6 +258,11 @@ int main(int argc, char* argv[]) signal(SIGTTIN,SIG_IGN); if (options->daemon.daemon) { + // For daemon mode replace default stderr with syslog. + if (options->log.outputs.size() == 1 && options->log.outputs[0] == "stderr") { + options->log.outputs[0] = "syslog"; + qpid::log::Logger::instance().configure(options->log); + } // Fork the daemon QpiddDaemon d(options->daemon.piddir); d.fork(); -- cgit v1.2.1