diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2019-11-25 05:37:53 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2020-04-30 19:22:24 +0200 |
commit | 0d82a87c0d590a0157e750a052b3a2f1b2c15070 (patch) | |
tree | a65206e7dd6e77119f0e373a874f885ecd8d5193 /src | |
parent | 9489a9ce4b7c395cb6ad8220eed407f80cc954e1 (diff) |
drop error log for when a subscriber does not exist
Checking for existence of a subscriber and seeing that there is none is not
inherently an error. However, osmo-hlr currently logs on all occasions:
DAUC ERROR Cannot read subscriber from db: MSISDN='1001': No such subscriber
This spams the ERROR log level. Particularly when a D-GSM setup does subscriber
existence checks for every incoming mslookup request, that potentially creates
constant ERROR logging.
The "No such subscriber" part comes from db_sel(), which might also return an
sqlite3_errmsg(). We still want those sqlite3_errmsg()es in the ERROR log.
Hence print an ERROR log only if db_sel() returns an rc != -ENOENT.
Change-Id: I5044e9b4519b948edc4e451cef0f7830d315619b
Diffstat (limited to 'src')
-rw-r--r-- | src/db_hlr.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/db_hlr.c b/src/db_hlr.c index 9073926..83c2c51 100644 --- a/src/db_hlr.c +++ b/src/db_hlr.c @@ -568,7 +568,7 @@ int db_subscr_get_by_imsi(struct db_context *dbc, const char *imsi, return -EIO; rc = db_sel(dbc, stmt, subscr, &err); - if (rc) + if (rc && rc != -ENOENT) LOGP(DAUC, LOGL_ERROR, "Cannot read subscriber from db: IMSI='%s': %s\n", imsi, err); return rc; @@ -619,7 +619,7 @@ int db_subscr_get_by_msisdn(struct db_context *dbc, const char *msisdn, return -EIO; rc = db_sel(dbc, stmt, subscr, &err); - if (rc) + if (rc && rc != -ENOENT) LOGP(DAUC, LOGL_ERROR, "Cannot read subscriber from db: MSISDN='%s': %s\n", msisdn, err); return rc; @@ -643,7 +643,7 @@ int db_subscr_get_by_id(struct db_context *dbc, int64_t id, return -EIO; rc = db_sel(dbc, stmt, subscr, &err); - if (rc) + if (rc && rc != -ENOENT) LOGP(DAUC, LOGL_ERROR, "Cannot read subscriber from db: ID=%" PRId64 ": %s\n", id, err); return rc; @@ -666,7 +666,7 @@ int db_subscr_get_by_imei(struct db_context *dbc, const char *imei, struct hlr_s return -EIO; rc = db_sel(dbc, stmt, subscr, &err); - if (rc) + if (rc && rc != -ENOENT) LOGP(DAUC, LOGL_ERROR, "Cannot read subscriber from db: IMEI=%s: %s\n", imei, err); return rc; } |