summaryrefslogtreecommitdiff
path: root/qpid/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
commit87335def6719cc7eb10a7cfeea8cf66c34eca1fc (patch)
tree7a74d32726f8053fade8377c592202a4293aeead /qpid/cpp/src/qpidd.cpp
parent876882dd2aee3e65980eec86ceae39f3d9e6b66c (diff)
downloadqpid-python-87335def6719cc7eb10a7cfeea8cf66c34eca1fc.tar.gz
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
Diffstat (limited to 'qpid/cpp/src/qpidd.cpp')
-rw-r--r--qpid/cpp/src/qpidd.cpp9
1 files changed, 7 insertions, 2 deletions
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();