From b6cfa948285ad64917723eb9d572e1c6f27551a8 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Tue, 15 Mar 2016 11:51:43 +0100 Subject: [PATCH] Add a disable-syslog setting This allows the use of e.g. the `Type=simple` in systemd and prevents the double logging issue. --- docs/markdown/authoritative/settings.md | 8 ++++++++ docs/markdown/recursor/settings.md | 8 ++++++++ pdns/common_startup.cc | 1 + pdns/logger.cc | 2 +- pdns/logger.hh | 5 +++++ pdns/pdns.conf-dist | 5 +++++ pdns/pdns_recursor.cc | 2 ++ pdns/receiver.cc | 1 + 8 files changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/markdown/authoritative/settings.md b/docs/markdown/authoritative/settings.md index 2cdd7e538..a47a1a47c 100644 --- a/docs/markdown/authoritative/settings.md +++ b/docs/markdown/authoritative/settings.md @@ -259,6 +259,14 @@ Do not allow zone transfers. Disable the rectify step during an outgoing AXFR. Only required for regression testing. +## `disable-syslog` +* Boolean +* Default: no + +Do not log to syslog, only to stdout. Use this setting when running inside a +supervisor that handles logging (like systemd). **Note**: do not use this setting +in combination with [`daemon`](#daemon) as all logging will disappear. + ## `disable-tcp` * Boolean * Default: no diff --git a/docs/markdown/recursor/settings.md b/docs/markdown/recursor/settings.md index 0b573a55f..e8cbd6f7a 100644 --- a/docs/markdown/recursor/settings.md +++ b/docs/markdown/recursor/settings.md @@ -167,6 +167,14 @@ Which domains we only accept delegations from (a Verisign special). Turn off the packet cache. Useful when running with Lua scripts that can not be cached. +## `disable-syslog` +* Boolean +* Default: no + +Do not log to syslog, only to stdout. Use this setting when running inside a +supervisor that handles logging (like systemd). **Note**: do not use this setting +in combination with [`daemon`](#daemon) as all logging will disappear. + ## `dnssec` * One of `off`, `process`, `log-fail`, `validate`, String * Default: `off` (**note**: was `process` until 4.0.0-alpha2) diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index fb4195418..237ee3cde 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -88,6 +88,7 @@ void declareArguments() ::arg().set("version-string","PowerDNS version in packets - full, anonymous, powerdns or custom")="full"; ::arg().set("control-console","Debugging switch - don't use")="no"; // but I know you will! ::arg().set("loglevel","Amount of logging. Higher is more. Do not set below 3")="4"; + ::arg().set("disable-syslog","Disable logging to syslog, useful when running inside a supervisor that logs stdout")="no"; ::arg().set("default-soa-name","name to insert in the SOA record if none set in the backend")="a.misconfigured.powerdns.server"; ::arg().set("default-soa-mail","mail address to insert in the SOA record if none set in the backend")=""; ::arg().set("distributor-threads","Default number of Distributor (backend) threads to start")="3"; diff --git a/pdns/logger.cc b/pdns/logger.cc index d4fcdcd7a..a21000466 100644 --- a/pdns/logger.cc +++ b/pdns/logger.cc @@ -56,7 +56,7 @@ void Logger::log(const string &msg, Urgency u) Lock l(&m); // the C++-2011 spec says we need this, and OSX actually does clog << string(buffer) + msg <