Skip to content

Reduce log level for some repo methods #507

@keiranjprice101

Description

@keiranjprice101

Description of the issue

In several places in the codebase, we log missing records using logger.exception() like so:

logger.exception("No result found for %s", spec.value)

This creates a log that looks like an application failure, even though in some contexts — such as when querying for an optional resource — this is expected behavior.

For example:

script_object = self._script_repo.find_one(ScriptSpecification().by_script_hash(script_hash))
if script_object is None:
    script_object = Script(script=script, script_hash=hash_script(script))
return script_object

In this case, a None result is normal and handled gracefully, but the log still appears as an exception and may be confusing to a reader.

Suggestion

We should downgrade the logging level for this pattern where missing results are expected. Options include:

This may also effect other methods, but this one creates a lot of noise in cycle as it triggers everytime a new job / run is created

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions