DOCSP-55530: Add logging #64
Merged
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.
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
RequestLoggingFilter.java- HTTP request logging filter that logs method, URL, status code, and response timeapplication.properties- Enhanced logging configuration with configurableLOG_LEVEL, colorized console output, and optional file loggingPython FastAPI Backend
src/utils/logger.py- Centralized logging utility with colorized output and configurable levelssrc/middleware/__init__.py- Middleware package initializationsrc/middleware/request_logging.py- Request logging middlewaremain.py- Integrated logger and request logging middleware, replacedprint()withloggercalls.env.example- AddedLOG_LEVELandLOG_FILEconfiguration optionsExpress Backend
src/utils/logger.ts- Centralized logging utility using Winstonsrc/middleware/requestLogger.ts- Request logging middlewaredatabase.ts- Integrated logger and request logging middlewareerrorHandler.ts- Integrated logger and request logging middleware.env.example- AddedLOG_LEVELconfiguration optionNext.js Client (No Changes)
Frontend logging is handled by the browser console; no server-side logging needed.
Consistency Across Backends
LOG_LEVELLOG_LEVELLOG_LEVELlogs/LOG_FILELOG_FILELog Format (All Backends)
Example output:
Testing