: Run in foreground, but do not spawn a console. Use this switch to run
dnsdist inside a supervisor (use with e.g. systemd and daemontools).
+--disable-syslog
+: Disable logging to syslog. Use this when running inside a supervisor that
+ handles logging (like systemd). Do not use in combination with **--daemon**.
+
-p,--pidfile *FILE*
: Write a pidfile to *FILE*, works only with **--daemon**.
bool g_console;
bool g_verboseHealthChecks{false};
uint32_t g_staleCacheEntriesTTL{0};
+bool g_syslog{true};
GlobalStateHolder<NetmaskGroup> g_ACL;
string g_outputBuffer;
{"daemon", 0, 0, 'd'},
{"pidfile", required_argument, 0, 'p'},
{"supervised", 0, 0, 's'},
+ {"disable-syslog", 0, 0, 2},
{"uid", required_argument, 0, 'u'},
{"verbose", 0, 0, 'v'},
{"version", 0, 0, 'V'},
case 1:
g_cmdLine.checkConfig=true;
break;
+ case 2:
+ g_syslog=false;
+ break;
case 'C':
g_cmdLine.config=optarg;
break;
cout<<"-l,--local address Listen on this local address\n";
cout<<"--supervised Don't open a console, I'm supervised\n";
cout<<" (use with e.g. systemd and daemontools)\n";
+ cout<<"--disable-syslog Don't log to syslog, only to stdout\n";
+ cout<<" (use with e.g. systemd)\n";
cout<<"-p,--pidfile file Write a pidfile, works only with --daemon\n";
cout<<"-u,--uid uid Change the process user ID after binding sockets\n";
cout<<"-v,--verbose Enable verbose mode\n";
extern bool g_console;
extern bool g_verbose;
+extern bool g_syslog;
template<typename... Args>
void genlog(int level, const char* s, Args... args)
{
std::ostringstream str;
dolog(str, s, args...);
- syslog(level, "%s", str.str().c_str());
+ if(g_syslog)
+ syslog(level, "%s", str.str().c_str());
if(g_console)
std::cout<<str.str()<<std::endl;
}