Add comprehensive structured logging and fix CI Docker build step#1
Merged
mayank1008-tech merged 2 commits intoMar 15, 2026
Merged
Conversation
…s, controllers, filters and utilities; fix CI workflow Co-authored-by: mayank1008-tech <245725096+mayank1008-tech@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add comprehensive structured logging with SLF4J and Logback
Add comprehensive structured logging and fix CI Docker build step
Mar 15, 2026
mayank1008-tech
approved these changes
Mar 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces ad-hoc
System.out.printlncalls with production-grade SLF4J structured logging across all layers, and removes the slow Docker image build job from CI.CI Fix
build-dockerjob from.github/workflows/ci.yml— was blocking pipeline without value for unit-test-only workflowsLogging Infrastructure
logback.xml: Console + rolling file appender (100MB/day, 30-day retention), DEBUG forcom.example.ledgersystem, WARN for Hibernate SQLlogback-test.xml: Console-only, DEBUG for app packages, WARN rootService Layer
AccountServiceImpl— transfer/deposit/balance/statement: INFO on entry/exit, WARN on insufficient funds/unauthorized/duplicate, DEBUG for cache hits/misses, ERROR for missing accountsAdminServiceImpl— audit: INFO start/result, WARN on broken chain or data modification, DEBUG per-entryRateLimitingService— DEBUG on bucket key resolution and config creationUserDetailsServiceImpl— DEBUG on lookup, WARN on not foundDataSeeder— replaced allSystem.out.println; INFO seed completion with account IDsControllers
AccountController,AuthController,AdminController— INFO on every API call with request params; WARN on rate-limit exceeded and rejected auth attemptsSecurity / JWT
AuthTokenFilter,AuthEntryPointJwt,JwtUtils— converted from manualLoggerFactoryto@Slf4j; replacedSystem.out.println("Validate"); JWT exceptions downgraded from ERROR to WARN; auth failures log request pathUtilities & Exception Handling
AuthUtils— DEBUG on security context readsHashUtils— static SLF4J logger; ERROR onNoSuchAlgorithmExceptionMyGlobalExceptionHandler— WARN log on every exception handler with message contextLog level strategy
Example transfer log sequence:
Original prompt
Add Comprehensive Structured Logging
Overview
Add professional structured logging using SLF4J and Logback to all services, controllers, filters, and critical methods in the LedgerSystem project. This will enable production-ready debugging, audit trails, and operational visibility.
What Needs to Be Done
1. Create Logback Configuration
src/main/resources/logback.xmlwith:2. Add Logging to All Service Classes
Add
@Slf4jannotation and implement logging in:3. Add Logging to All Controllers
Add
@Slf4jannotation and implement logging in:4. Add Logging to Filters and Security Classes
5. Add Logging to Utilities and Other Critical Classes
Logging Strategy
Log Levels Used:
Log Format:
Context Information to Include:
File Structure Changes:
Example Logging in Methods
Transfer Operation:
Failed Transfer:
Authentication:
Rate Limiting: