Skip to content

Commit

Permalink
Allow daemon to log to stdout as journald can still log the output
Browse files Browse the repository at this point in the history
  • Loading branch information
mtorromeo committed Mar 19, 2021
1 parent 20dd2db commit a9e0c30
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
8 changes: 0 additions & 8 deletions janus.c
Original file line number Diff line number Diff line change
Expand Up @@ -4101,14 +4101,6 @@ gint main(int argc, char *argv[])
if(item && item->value && janus_is_true(item->value))
daemonize = TRUE;
}
/* If we're going to daemonize, make sure logging to stdout is disabled and a log file has been specified */
if(daemonize && use_stdout) {
use_stdout = FALSE;
}
if(daemonize && logfile == NULL) {
g_print("Running Janus as a daemon but no log file provided, giving up...\n");
exit(1);
}
/* Daemonize now, if we need to */
if(daemonize) {
g_print("Running Janus as a daemon\n");
Expand Down
15 changes: 0 additions & 15 deletions log.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,21 +239,6 @@ int janus_log_init(gboolean daemon, gboolean console, const char *logfile) {
g_print("WARNING: logging completely disabled!\n");
g_print(" (no stdout and no logfile, this may not be what you want...)\n");
}
if(daemon) {
/* Replace the standard file descriptors */
if (freopen("/dev/null", "r", stdin) == NULL) {
g_print("Error replacing stdin with /dev/null\n");
return -1;
}
if (freopen("/dev/null", "w", stdout) == NULL) {
g_print("Error replacing stdout with /dev/null\n");
return -1;
}
if (freopen("/dev/null", "w", stderr) == NULL) {
g_print("Error replacing stderr with /dev/null\n");
return -1;
}
}
printthread = g_thread_new(THREAD_NAME, &janus_log_thread, NULL);
return 0;
}
Expand Down

0 comments on commit a9e0c30

Please sign in to comment.