use SIGHUP for reopening log file

This commit is contained in:
john30
2017-01-15 12:37:01 +01:00
parent a1d3042945
commit b7c7ad9283
3 changed files with 10 additions and 1 deletions
+4
View File
@@ -590,6 +590,10 @@ void signalHandler(int sig) {
switch (sig) {
case SIGHUP:
logNotice(lf_main, "SIGHUP received");
if (!opt.foreground) {
closeLogFile();
setLogFile(opt.logFile);
}
break;
case SIGINT:
logNotice(lf_main, "SIGINT received");
+3
View File
@@ -141,6 +141,9 @@ bool needsLog(const LogFacility facility, const LogLevel level) {
}
void logWrite(const char* facility, const char* level, const char* message, va_list ap) {
if (s_logFile == NULL) {
return;
}
struct timespec ts;
struct tm td;
clockGettime(&ts);