Skip to content

Commit

Permalink
dlt-daemon: fix internal logging to file after daemonize
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Lipka <[email protected]>
  • Loading branch information
Christoph Lipka authored and ssugiura committed May 6, 2019
1 parent 09d49ba commit a729e27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/daemon/dlt-daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,11 @@ int dlt_daemon_local_init_p1(DltDaemon *daemon, DltDaemonLocal *daemon_local, in
if (daemon_local->flags.dflag)
dlt_daemon_daemonize(daemon_local->flags.vflag);

/* Re-Initialize internal logging facility after fork */
dlt_log_set_filename(daemon_local->flags.loggingFilename);
dlt_log_set_level(daemon_local->flags.loggingLevel);
dlt_log_init(daemon_local->flags.loggingMode);

/* initialise structure to use DLT file */
ret = dlt_file_init(&(daemon_local->file), daemon_local->flags.vflag);

Expand Down
2 changes: 1 addition & 1 deletion src/shared/dlt_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ void dlt_log_init(int mode)

if (logging_mode == DLT_LOG_TO_FILE) {
/* internal logging to file */
logging_handle = fopen(logging_filename, "w");
logging_handle = fopen(logging_filename, "a");

if (logging_handle == NULL) {
printf("Internal log file %s cannot be opened!\n", logging_filename);
Expand Down

0 comments on commit a729e27

Please sign in to comment.