summaryrefslogtreecommitdiff
path: root/cpp/src/qpidd.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-06-12 21:59:27 +0000
committerAlan Conway <aconway@apache.org>2008-06-12 21:59:27 +0000
commit893c80ca40c1235224d93ed94348f25f51b1f0b7 (patch)
treec69d47c32ac6554e69b3a72c2aca364a3f37a8d9 /cpp/src/qpidd.cpp
parent3bed3ead3ed828b2a26f696cfad6e1bbdb0ffb28 (diff)
downloadqpid-python-893c80ca40c1235224d93ed94348f25f51b1f0b7.tar.gz
Default --log-output to syslog in --daemon mode.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@667253 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpidd.cpp')
-rw-r--r--cpp/src/qpidd.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/cpp/src/qpidd.cpp b/cpp/src/qpidd.cpp
index 23781ead2c..0194f9af23 100644
--- a/cpp/src/qpidd.cpp
+++ b/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();