Skip to content

Conversation

@cbullinger
Copy link
Collaborator

@cbullinger cbullinger commented Jan 8, 2026

Add Consistent Request Logging Across All Backends

Summary

Implements consistent HTTP request logging across Express, Java Spring, and Python FastAPI backends. All three backends now have colorized console output, configurable log levels, and appropriate log severity based on HTTP status codes.

Changes

Java Spring Backend

  • New file: RequestLoggingFilter.java - HTTP request logging filter that logs method, URL, status code, and response time
  • Updated: application.properties - Enhanced logging configuration with configurable LOG_LEVEL, colorized console output, and optional file logging

Python FastAPI Backend

  • New file: src/utils/logger.py - Centralized logging utility with colorized output and configurable levels
  • New file: src/middleware/__init__.py - Middleware package initialization
  • New file: src/middleware/request_logging.py - Request logging middleware
  • Updated: main.py - Integrated logger and request logging middleware, replaced print() with logger calls
  • Updated: .env.example - Added LOG_LEVEL and LOG_FILE configuration options

Express Backend

  • New file: src/utils/logger.ts - Centralized logging utility using Winston
  • New file: src/middleware/requestLogger.ts - Request logging middleware
  • Updated: database.ts - Integrated logger and request logging middleware
  • Updated: errorHandler.ts - Integrated logger and request logging middleware
  • Updated: .env.example - Added LOG_LEVEL configuration option

Next.js Client (No Changes)

Frontend logging is handled by the browser console; no server-side logging needed.

Consistency Across Backends

Feature Express Java Spring Python FastAPI
Request logging Winston Filter (SLF4J/Logback (built-in)) Middleware
Colorized output x x x
Configurable level LOG_LEVEL LOG_LEVEL LOG_LEVEL
File logging logs/ LOG_FILE LOG_FILE
Status-based severity x x x

Log Format (All Backends)

HH:MM:SS LEVEL : METHOD /path STATUS - TIMEms

Example output:

17:22:22 INFO  : GET /api/movies 200 - 45ms
17:22:22 WARN  : GET /api/movies/invalid 400 - 2ms
17:22:22 ERROR : POST /api/movies 500 - 120ms

Testing

  • All Python unit tests pass ✅
  • All Java unit tests pass ✅
  • All Express unit tests pass ✅

Copy link
Collaborator

@tmcneil-mdb tmcneil-mdb left a comment

Choose a reason for hiding this comment

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

lgtm!

I was able to get it working for all three backends.

Nit: The Express backend does seem to produce extra logs if a search index is present. I think its logging an error if a index already exists?

@cbullinger cbullinger merged commit 6c8e91b into development Jan 13, 2026
3 checks passed
@cbullinger cbullinger deleted the docsp-55530-logging branch January 14, 2026 13:48
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