way of figuring out what IP address a packet was sent to when binding to
any.
+.. _setting-log-timestamp:
+
+``log-timestamp``
+-----------------
+
+.. versionadded:: 4.1.0
+
+- Bool
+- Default: yes
+
+When printing log lines to stdout, prefix them with timestamps.
+Disable this if the process supervisor timestamps these lines already.
+
+.. note::
+ The systemd unit file supplied with the source code already disables timestamp printing
+
.. _setting-non-local-bind:
``non-local-bind``
::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("log-timestamp","Print timestamps in log lines")="yes";
::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";
#ifndef RECURSOR
bool mustAccount(false);
#endif
- struct tm tm;
- time_t t;
- time(&t);
- tm=*localtime(&t);
-
if(u<=consoleUrgency) {
- char buffer[50];
- strftime(buffer,sizeof(buffer),"%b %d %H:%M:%S ", &tm);
+ char buffer[50] = "";
+ if (d_timestamps) {
+ struct tm tm;
+ time_t t;
+ time(&t);
+ tm=*localtime(&t);
+ strftime(buffer,sizeof(buffer),"%b %d %H:%M:%S ", &tm);
+ }
+
static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
Lock l(&m); // the C++-2011 spec says we need this, and OSX actually does
clog << string(buffer) + msg <<endl;
d_disableSyslog = d;
}
+ void setTimestamps(bool t) {
+ d_timestamps = t;
+ }
+
//! Log to a file.
void toFile( const string & filename );
Urgency consoleUrgency;
bool opened;
bool d_disableSyslog;
+ bool d_timestamps{true};
static pthread_once_t s_once;
static pthread_key_t s_loggerKey;
};
[Service]
Type=notify
-ExecStart=@sbindir@/pdns_server --guardian=no --daemon=no --disable-syslog --write-pid=no
+ExecStart=@sbindir@/pdns_server --guardian=no --daemon=no --disable-syslog --log-timestamp=no --write-pid=no
Restart=on-failure
RestartSec=1
StartLimitInterval=0
{
L.setName(s_programname);
L.disableSyslog(::arg().mustDo("disable-syslog"));
+ L.setTimestamps(::arg().mustDo("log-timestamp"));
if(!::arg()["logging-facility"].empty()) {
int val=logFacilityToLOG(::arg().asNum("logging-facility") );
::arg().setSwitch("write-pid","Write a PID file")="yes";
::arg().set("loglevel","Amount of logging. Higher is more. Do not set below 3")="6";
::arg().set("disable-syslog","Disable logging to syslog, useful when running inside a supervisor that logs stdout")="no";
+ ::arg().set("log-timestamp","Print timestamps in log lines, useful to disable when running with a tool that timestamps stdout already")="yes";
::arg().set("log-common-errors","If we should log rather common errors")="no";
::arg().set("chroot","switch to chroot jail")="";
::arg().set("setgid","If set, change group id to this gid for more security")="";
L.setLoglevel((Logger::Urgency)(::arg().asNum("loglevel")));
L.disableSyslog(::arg().mustDo("disable-syslog"));
+ L.setTimestamps(::arg().mustDo("log-timestamp"));
L.toConsole((Logger::Urgency)(::arg().asNum("loglevel")));
if(::arg().mustDo("help") || ::arg().mustDo("config")) {
Local port to bind to.
If an address in `local-address`_ does not have an explicit port, this port is used.
+.. _setting-log-timestamp:
+
+``log-timestamp``
+-----------------
+
+.. versionadded:: 4.1.0
+
+- Bool
+- Default: yes
+
+When printing log lines to stdout, prefix them with timestamps.
+Disable this if the process supervisor timestamps these lines already.
+
+.. note::
+ The systemd unit file supplied with the source code already disables timestamp printing
+
.. _setting-non-local-bind:
``non-local-bind``
[Service]
Type=notify
-ExecStart=@sbindir@/pdns_recursor --daemon=no --write-pid=no --disable-syslog
+ExecStart=@sbindir@/pdns_recursor --daemon=no --write-pid=no --disable-syslog --log-timestamp=no
Restart=on-failure
StartLimitInterval=0
PrivateTmp=true