VSB-TUO/Reduce noisy WARN logs to DEBUG level#1263
VSB-TUO/Reduce noisy WARN logs to DEBUG level#1263milanmajchrak merged 1 commit intocustomer/vsb-tuofrom
Conversation
Changed two frequently occurring WARN log messages to DEBUG level: - Context.java: 'Initializing a context while an active transaction exists' - ClarinItemServiceImpl.java: 'Cannot update item dates metadata because the approximate date is empty'
There was a problem hiding this comment.
Pull request overview
This PR reduces log noise by downgrading two frequently emitted log statements from WARN to DEBUG in core Context initialization and Clarin item date-metadata updates.
Changes:
- Downgrade “active transaction exists during Context init” log from WARN to DEBUG.
- Downgrade “approximate date is empty” log from WARN to DEBUG in
updateItemDatesMetadata().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dspace-api/src/main/java/org/dspace/core/Context.java | Lowers transaction-related initialization log verbosity to reduce WARN noise. |
| dspace-api/src/main/java/org/dspace/content/clarin/ClarinItemServiceImpl.java | Lowers verbosity for missing approximate-date log during item date metadata updates. |
| log.debug("Initializing a context while an active transaction exists. Context with hash: {}.", | ||
| getHash()); |
There was a problem hiding this comment.
This log is triggered when isTransactionAlive() is true during Context initialization, which can indicate an already-open transaction in the current thread (often a sign of an unclosed Context/transaction leak). Dropping this from WARN to DEBUG may make it much harder to detect these issues in production. Consider keeping it at WARN (or at least INFO), or adding more diagnostic detail (e.g., include current thread/request info or an optional stacktrace when debug is enabled) so it remains actionable when it occurs.
| if (CollectionUtils.isEmpty(approximatedDates) || StringUtils.isBlank(approximatedDates.get(0).getValue())) { | ||
| log.warn("Cannot update item dates metadata because the approximate date is empty."); | ||
| log.debug("Cannot update item dates metadata because the approximate date is empty."); | ||
| return; |
There was a problem hiding this comment.
Now that this is DEBUG-only, the message becomes less actionable because it doesn't identify which Item is being processed. Consider including the item UUID/ID (and possibly the metadata field name) in the log message so that enabling DEBUG helps pinpoint the problematic record without additional instrumentation.
Problem description
Changed two frequently occurring WARN log messages to DEBUG level:
Analysis
(Write here, if there is needed describe some specific problem. Erase it, when it is not needed.)
Problems
(Write here, if some unexpected problems occur during solving issues. Erase it, when it is not needed.)
Manual Testing (if applicable)
Copilot review