diff options
author | Sebastian Kloska <sebastian.kloska@snafu.de> | 2019-10-10 13:05:26 +0200 |
---|---|---|
committer | Saya Sugiura <39760799+ssugiura@users.noreply.github.com> | 2019-10-10 23:27:31 +0900 |
commit | da36b5b4fe7a25da4a272618db67601c0f6e3d3a (patch) | |
tree | d49b526a8fa24f1298eb7b7c50f867192a85bd6b /src/daemon | |
parent | db669dda273b31215a6b002fd7c753f394649369 (diff) | |
download | DLT-daemon-da36b5b4fe7a25da4a272618db67601c0f6e3d3a.tar.gz |
Fix: Propper usage of LoggingMode in ".../dlt-runtime.cfg"
* Symptom: no offline trace file gets created
even if runtime config LoggingMode==(2|3).
* Reason: runtime config gets read *after*
offline logging setup.
* Solution: Read runtime config *before*
offline logging setup.
* Make the "read runtime config" function
set a proper default value for logging mode
instead if the *_init_* function setting up
the logging.
Signed-off-by: Sebastian Kloska <sebastian.kloska@snafu.de>
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/dlt-daemon.c | 10 | ||||
-rw-r--r-- | src/daemon/dlt_daemon_common.c | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c index b53e5d1..970ad80 100644 --- a/src/daemon/dlt-daemon.c +++ b/src/daemon/dlt-daemon.c @@ -813,6 +813,11 @@ int main(int argc, char *argv[]) /* --- Daemon connection init end */ + if (dlt_daemon_load_runtime_configuration(&daemon, daemon_local.flags.ivalue, daemon_local.flags.vflag) == -1) { + dlt_log(LOG_ERR, "Could not load runtime config\n"); + return -1; + } + /* --- Daemon init phase 2 begin --- */ if (dlt_daemon_local_init_p2(&daemon, &daemon_local, daemon_local.flags.vflag) == -1) { dlt_log(LOG_CRIT, "Initialization of phase 2 failed!\n"); @@ -884,11 +889,6 @@ int main(int argc, char *argv[]) daemon_local.flags.gatewayMode, daemon_local.flags.vflag); - if (dlt_daemon_load_runtime_configuration(&daemon, daemon_local.flags.ivalue, daemon_local.flags.vflag) == -1) { - dlt_log(LOG_ERR, "Could not load runtime config\n"); - return -1; - } - dlt_daemon_log_internal(&daemon, &daemon_local, "Daemon launched. Starting to output traces...", diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c index 2bf6647..49716c4 100644 --- a/src/daemon/dlt_daemon_common.c +++ b/src/daemon/dlt_daemon_common.c @@ -145,7 +145,13 @@ int dlt_daemon_load_runtime_configuration(DltDaemon *daemon, const char *runtime { int append_length = 0; - if ((daemon == NULL) || (runtime_directory == NULL)) + if ( daemon == NULL ) + return DLT_RETURN_ERROR; + + // Default + daemon->mode = DLT_USER_MODE_EXTERNAL; + + if ( runtime_directory == NULL ) return DLT_RETURN_ERROR; /* prepare filenames for configuration */ @@ -225,8 +231,6 @@ int dlt_daemon_init(DltDaemon *daemon, daemon->runtime_context_cfg_loaded = 0; - daemon->mode = DLT_USER_MODE_EXTERNAL; - daemon->connectionState = 0; /* no logger connected */ daemon->state = DLT_DAEMON_STATE_INIT; /* initial logging state */ |