Skip to content

VSB-TUO/Reduce noisy WARN logs to DEBUG level#1263

Merged
milanmajchrak merged 1 commit intocustomer/vsb-tuofrom
vsb-tuo/update-warn-logs
Mar 3, 2026
Merged

VSB-TUO/Reduce noisy WARN logs to DEBUG level#1263
milanmajchrak merged 1 commit intocustomer/vsb-tuofrom
vsb-tuo/update-warn-logs

Conversation

@milanmajchrak
Copy link
Collaborator

Problem description

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'

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

  • Requested review from Copilot

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'
Copilot AI review requested due to automatic review settings March 3, 2026 15:58
@milanmajchrak milanmajchrak merged commit 47dd0b1 into customer/vsb-tuo Mar 3, 2026
9 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +190 to +191
log.debug("Initializing a context while an active transaction exists. Context with hash: {}.",
getHash());
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 229 to 231
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;
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants