Skip to content

chore: standardize logger field name to LOGGER#558

Open
ThanuH wants to merge 2 commits into
labsai:mainfrom
ThanuH:chore/standardize-loggers
Open

chore: standardize logger field name to LOGGER#558
ThanuH wants to merge 2 commits into
labsai:mainfrom
ThanuH:chore/standardize-loggers

Conversation

@ThanuH

@ThanuH ThanuH commented Jun 20, 2026

Copy link
Copy Markdown

Summary

Standardizes the logger naming convention across 8 files in the engine package. Renamed log and LOG fields to LOGGER to ensure consistency with the project's established convention and improve grep-ability

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • [ X] ♻️ Refactoring (no functional changes)
  • 🔧 Chore (dependency updates, CI changes, etc.)

Related Issue

Closes #

Changes Made

  • Renamed private static final Logger log/LOG to private static final Logger LOGGER in 8 files.
  • Updated all associated logging method calls (e.g., info, warn, error) to reference the new LOGGER field.
  • Affected classes:
    • ResourceStoreExceptionMapper.java
    • HttpClientWrapper.java
    • RestAgentAdministration.java
    • RestAgentManagement.java
    • RestCoordinatorAdmin.java
    • RestLogAdmin.java
    • RestConversationStore.java
    • DocumentDescriptorFilter.java

How to Test

  1. Run ./mvnw clean compile to ensure the syntax is correct.
  2. Run ./mvnw test -DskipITs to verify that existing unit tests pass after the refactoring.

Checklist

  • [x ] My code follows the project's code style
  • [ x] I have added tests that prove my fix/feature works
  • [ x] Existing tests pass locally (./mvnw clean verify -DskipITs)
  • [ x] I have updated documentation if needed
  • [ x] My commit messages follow conventional commits
  • [ x] I have not committed any secrets, API keys, or tokens
  • [ x] This PR has a clear, focused scope (one concern per PR)

Summary by CodeRabbit

  • Chores
    • Standardized internal logging naming by switching logger field usage to a consistent project-wide LOGGER convention across REST and HTTP components.
    • Updated log statements (warn/debug/info/error) to use the standardized logger while keeping REST, SSE, and response behavior the same.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Across 8 engine classes, static logger fields named log are renamed to LOGGER and all corresponding logging call sites are updated. No public API signatures, control flow, or data handling logic are changed.

Changes

Logger Field Standardization

Layer / File(s) Summary
Straightforward logLOGGER renames
src/main/java/ai/labs/eddi/engine/exception/ResourceStoreExceptionMapper.java, src/main/java/ai/labs/eddi/engine/httpclient/impl/HttpClientWrapper.java, src/main/java/ai/labs/eddi/engine/internal/RestAgentManagement.java, src/main/java/ai/labs/eddi/engine/internal/RestCoordinatorAdmin.java, src/main/java/ai/labs/eddi/engine/memory/rest/RestConversationStore.java, src/main/java/ai/labs/eddi/engine/runtime/rest/interceptors/DocumentDescriptorFilter.java
Logger field declarations and all call sites (warn, debug, info, error, infof, warnf, debugf) are updated from log to LOGGER with no behavioral change.
Logger rename in RestAgentAdministration
src/main/java/ai/labs/eddi/engine/internal/RestAgentAdministration.java
Logger field declaration and all call sites across deployAgent, undeployAgent, undeploy, throwErrorForbidden, enableSchedulesForAgent, and disableSchedulesForAgent methods updated from log to LOGGER.
Logger rename in RestLogAdmin
src/main/java/ai/labs/eddi/engine/internal/RestLogAdmin.java
Logger field and all logging call sites in streamLogs and sendEvent methods updated from log to LOGGER.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related issues

Poem

🐇 Hop, hop, hooray for tidy code today!
The log has grown up, now LOGGER it stays,
Uppercase and proud across eight little files,
Each warning and error now logged with more style.
This bunny approves — consistent and bright!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.82% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: standardizing logger field names to LOGGER across multiple files in the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/java/ai/labs/eddi/engine/internal/RestLogAdmin.java`:
- Line 117: The SSE event name in the RestLogAdmin.java file has been changed
from "log" to "LOGGER" in the sse.newEventBuilder().name() call, which breaks
existing clients that subscribe with addEventListener("log", ...). Revert the
event name parameter in the newEventBuilder().name() method call back to "log"
to maintain backward compatibility with existing log-stream consumers, while you
can keep any logger variable identifier changes separate from the event type.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6f96e099-87be-4f5c-b581-da2c3c5a6a18

📥 Commits

Reviewing files that changed from the base of the PR and between bd1b859 and d0a0232.

📒 Files selected for processing (8)
  • src/main/java/ai/labs/eddi/engine/exception/ResourceStoreExceptionMapper.java
  • src/main/java/ai/labs/eddi/engine/httpclient/impl/HttpClientWrapper.java
  • src/main/java/ai/labs/eddi/engine/internal/RestAgentAdministration.java
  • src/main/java/ai/labs/eddi/engine/internal/RestAgentManagement.java
  • src/main/java/ai/labs/eddi/engine/internal/RestCoordinatorAdmin.java
  • src/main/java/ai/labs/eddi/engine/internal/RestLogAdmin.java
  • src/main/java/ai/labs/eddi/engine/memory/rest/RestConversationStore.java
  • src/main/java/ai/labs/eddi/engine/runtime/rest/interceptors/DocumentDescriptorFilter.java

Comment thread src/main/java/ai/labs/eddi/engine/internal/RestLogAdmin.java Outdated
@ThanuH ThanuH closed this Jun 20, 2026
@ThanuH ThanuH reopened this Jun 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/java/ai/labs/eddi/engine/internal/RestLogAdmin.java`:
- Around line 98-106: Update all LOGGER.debugv log messages at lines 98, 106,
118, and 122 in the RestLogAdmin.java file to include both conversationId and
agentId as context identifiers in the log output. For each log message, add
conversationId and agentId as parameters to the debugv call and update the
format string to include placeholders for these values. Ensure all four log
messages follow a consistent pattern that includes these required context
identifiers for proper correlation during debugging and incident analysis.
- Around line 99-102: The catch block that handles Exception at lines 99-102
silently swallows the exception without logging, which hides cleanup failures
and weakens diagnosability. Replace the empty exception handler by adding a log
statement that captures the error with appropriate context (conversationId,
agentId if available) at a suitable level (DEBUG or WARN). Include an actionable
error message that describes what cleanup operation failed, while keeping the
exception handler in place to prevent the exception from propagating and killing
the pipeline. Ensure the log provides enough detail for debugging listener
removal or other cleanup failures without generating excessive noise during
normal operation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5f6ac3dc-0068-4b62-b1ca-207abb58423e

📥 Commits

Reviewing files that changed from the base of the PR and between d0a0232 and 289273f.

📒 Files selected for processing (1)
  • src/main/java/ai/labs/eddi/engine/internal/RestLogAdmin.java

Comment on lines +98 to +106
LOGGER.debugv("SSE log listener {0} removed (client disconnected or max lifetime reached)", listenerId);
} catch (Exception e) {
// CDI container may already be shut down (e.g. during test teardown) —
// swallow to avoid noisy "ArC container not initialized" stacktraces
}
}
});

log.debugv("SSE log stream started (listenerId={0}, agentId={1}, level={2})", listenerId, agentId, level);
LOGGER.debugv("SSE log stream started (listenerId={0}, agentId={1}, level={2})", listenerId, agentId, level);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Include conversationId + agentId in log messages for stream/send lifecycle events.

At Line 98, Line 106, Line 118, and Line 122, log messages currently omit one or both required context identifiers, which makes correlation harder during incident/debug analysis.

As per coding guidelines, “Include conversation context (conversationId, agentId) in log messages.”

Suggested fix
-                    LOGGER.debugv("SSE log listener {0} removed (client disconnected or max lifetime reached)", listenerId);
+                    LOGGER.debugv(
+                            "SSE log listener {0} removed (agentId={1}, conversationId={2}, client disconnected or max lifetime reached)",
+                            listenerId, agentId, conversationId
+                    );

-        LOGGER.debugv("SSE log stream started (listenerId={0}, agentId={1}, level={2})", listenerId, agentId, level);
+        LOGGER.debugv(
+                "SSE log stream started (listenerId={0}, agentId={1}, conversationId={2}, level={3})",
+                listenerId, agentId, conversationId, level
+        );

-                LOGGER.debugv("Failed to send SSE log event: {0}", t.getMessage());
+                LOGGER.debugv(
+                        "Failed to send SSE log event (agentId={0}, conversationId={1}): {2}",
+                        entry.agentId(), entry.conversationId(), t.getMessage()
+                );

-            LOGGER.debugv("Error sending SSE log event: {0}", e.getMessage());
+            LOGGER.debugv(
+                    "Error sending SSE log event (agentId={0}, conversationId={1}): {2}",
+                    entry.agentId(), entry.conversationId(), e.getMessage()
+            );

Also applies to: 118-122

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/ai/labs/eddi/engine/internal/RestLogAdmin.java` around lines 98
- 106, Update all LOGGER.debugv log messages at lines 98, 106, 118, and 122 in
the RestLogAdmin.java file to include both conversationId and agentId as context
identifiers in the log output. For each log message, add conversationId and
agentId as parameters to the debugv call and update the format string to include
placeholders for these values. Ensure all four log messages follow a consistent
pattern that includes these required context identifiers for proper correlation
during debugging and incident analysis.

Source: Coding guidelines

Comment on lines 99 to 102
} catch (Exception e) {
// CDI container may already be shut down (e.g. during test teardown) —
// swallow to avoid noisy "ArC container not initialized" stacktraces
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don’t silently swallow cleanup exceptions in the listener teardown path.

Line 99-Line 102 catches Exception and suppresses it entirely, which hides cleanup failures (e.g., failed listener removal) and weakens runtime diagnosability.

As per coding guidelines, “Log errors with conversation context (conversationId, agentId) ... Never let exceptions kill the pipeline — handle gracefully with actionable error messages.”

Suggested fix
-                } catch (Exception e) {
-                    // CDI container may already be shut down (e.g. during test teardown) —
-                    // swallow to avoid noisy "ArC container not initialized" stacktraces
-                }
+                } catch (Exception e) {
+                    LOGGER.debugv(
+                            e,
+                            "Failed to cleanup SSE listener (listenerId={0}, agentId={1}, conversationId={2})",
+                            listenerId, agentId, conversationId
+                    );
+                }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/ai/labs/eddi/engine/internal/RestLogAdmin.java` around lines 99
- 102, The catch block that handles Exception at lines 99-102 silently swallows
the exception without logging, which hides cleanup failures and weakens
diagnosability. Replace the empty exception handler by adding a log statement
that captures the error with appropriate context (conversationId, agentId if
available) at a suitable level (DEBUG or WARN). Include an actionable error
message that describes what cleanup operation failed, while keeping the
exception handler in place to prevent the exception from propagating and killing
the pipeline. Ensure the log provides enough detail for debugging listener
removal or other cleanup failures without generating excessive noise during
normal operation.

Source: Coding guidelines

deployFuture.get(30, TimeUnit.SECONDS);
} catch (TimeoutException e) {
log.warn("Deployment wait timed out for Agent " + agentId + " v" + version);
LOGGER.warn("Deployment wait timed out for Agent " + agentId + " v" + version);
log.warn("Deployment failed for Agent " + agentId + " v" + version + ": " + (cause != null ? cause.getMessage() : e.getMessage()),
// LOGGER full details server-side, expose only safe message to client
LOGGER.warn(
"Deployment failed for Agent " + agentId + " v" + version + ": " + (cause != null ? cause.getMessage() : e.getMessage()),
undeploy(environment, agentId, version);
log.info(String.format("Successfully undeployed Agent (agentId=%s, agentVersion=%s, environment=%s)", agentId, version, environment));
LOGGER.info(
String.format("Successfully undeployed Agent (agentId=%s, agentVersion=%s, environment=%s)", agentId, version, environment));
private Status throwError(String agentId, Integer version, ServiceException e, String message) {
message = String.format(message, agentId, version);
log.error(message, e);
LOGGER.error(message, e);
String message = "Agent deployment is currently in progress! (agentId=%s , version=%s)";
message = String.format(message, agentId, version);
log.error(message, e);
LOGGER.error(message, e);
}
} catch (Exception e) {
log.warnf(e, "[SCHEDULE] Failed to auto-disable schedules for Agent %s (non-fatal)", agentId);
LOGGER.warnf(e, "[SCHEDULE] Failed to auto-disable schedules for Agent %s (non-fatal)", agentId);
});

log.debugv("SSE log stream started (listenerId={0}, agentId={1}, level={2})", listenerId, agentId, level);
LOGGER.debugv("SSE log stream started (listenerId={0}, agentId={1}, level={2})", listenerId, agentId, level);
});

log.debugv("SSE log stream started (listenerId={0}, agentId={1}, level={2})", listenerId, agentId, level);
LOGGER.debugv("SSE log stream started (listenerId={0}, agentId={1}, level={2})", listenerId, agentId, level);
deleteAttachmentsForConversation(conversationId);
conversationMemoryStore.deleteConversationMemorySnapshot(conversationId);
log.info(format("Conversation has been permanently deleted (conversationId=%s)", conversationId));
LOGGER.info(format("Conversation has been permanently deleted (conversationId=%s)", conversationId));
long deleted = attachmentStorageInstance.get().deleteByConversation(conversationId);
if (deleted > 0) {
log.debug(format("Deleted %d attachments for conversation %s", deleted, conversationId));
LOGGER.debug(format("Deleted %d attachments for conversation %s", deleted, conversationId));

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

3 participants