laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-hlr/+/42018?usp=email )

Change subject: osmo-hlr: Force log stderr blocking-io in --db-check mode
......................................................................

osmo-hlr: Force log stderr blocking-io in --db-check mode

When --db-check is used, osmo-hlr actually becomes a synchronous
non-interactive program instead of a daemon.
In that case, we want to use blocking-io since it doesn't use the event
loop, so we want to flush all logging synchronously before exiting.

Usually the user will pass the same osmo-hlr.cfg when running with
--db-check, which means most probably won't be using blocking-io (as
expected when osmo-hlr runs in daemon mode).
Since --db-check converts osmo-hlr to a cmdline which exits after checks
are done, we actually want to force blocking-io in that case, so that
all content is written to stderr before finishing the process.

Change-Id: If5e505383086cc55d724c0d6891756c8d94fa267
---
M src/hlr.c
1 file changed, 5 insertions(+), 0 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/src/hlr.c b/src/hlr.c
index 0cfa09a..038a0a4 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -809,6 +809,11 @@
                return rc;
        }

+       if (cmdline_opts.db_check) {
+               /* Make sure to use synchronous logging to stderr in --db-check 
(non-interactive mode): */
+               log_target_file_switch_to_stream(osmo_stderr_target);
+       }
+
        LOGP(DMAIN, LOGL_NOTICE, "hlr starting\n");

        rc = rand_init();

--
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/42018?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: If5e505383086cc55d724c0d6891756c8d94fa267
Gerrit-Change-Number: 42018
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: jolly <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>

Reply via email to