Skip to content

[APIP + AIWS] Enhance logging and configuration in platform API#2477

Merged
Thushani-Jayasekera merged 5 commits into
wso2:mainfrom
Thushani-Jayasekera:improvements
Jul 7, 2026
Merged

[APIP + AIWS] Enhance logging and configuration in platform API#2477
Thushani-Jayasekera merged 5 commits into
wso2:mainfrom
Thushani-Jayasekera:improvements

Conversation

@Thushani-Jayasekera

@Thushani-Jayasekera Thushani-Jayasekera commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

#2345

  • Integrated a custom logger into the configuration loading process to ensure consistent log formatting across the application.
  • Updated the configuration file to enable SQLite database by default.
  • Improved source file path handling in the logger for better clarity in log messages.
  • Changed log output format for server startup to provide clearer information on the running mode.

Platform API - text logs

image

Platform API - json logs

image

AI Workspace - text logs

image

AI Workspace - json logs

image

- Integrated a custom logger into the configuration loading process to ensure consistent log formatting across the application.
- Updated the configuration file to enable SQLite database by default.
- Improved source file path handling in the logger for better clarity in log messages.
- Changed log output format for server startup to provide clearer information on the running mode.
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR installs the configured logger as the process-wide slog default in platform-api's config loading, replaces server startup banner logic in both the Platform API server and the AI Workspace BFF with structured slog logging plus a shared printStartedMarker console banner, and activates SQLite database settings in config.toml.

Changes

Logging Setup and Startup Output

Layer / File(s) Summary
Default slog logger wiring
platform-api/config/config.go
Imports the internal logger package and installs a configured slog default logger using cfg.LogLevel and cfg.LogFormat during LoadConfig.
Platform API server startup output
platform-api/internal/server/server.go
Replaces centered fmt.Printf banner with uppercase PRODUCTION/DEMO mode selection, a structured slog.Info("Platform API started") call, and a new printStartedMarker helper for console output.
AI Workspace BFF startup output
portals/ai-workspace/bff/main.go
Replaces the old banner helper with printStartedMarker, computes mode from cfg.DemoMode, adds mode to the structured startup log, and calls the new banner function.

Database Configuration

Layer / File(s) Summary
SQLite config activation
platform-api/config/config.toml
Enables driver = "sqlite3" and sets path to /app/data/api_platform.db under [database], replacing previous commented defaults.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: RakhithaRR, Tharsanan1, VirajSalaka, renuka-fernando

Poem:
A rabbit hopped through logs at dawn,
Set slog's default before code's spawn.
Banners bloomed with PRODUCTION flair,
SQLite paths now active there.
Hop, hop, deploy — the marker's shown! 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is missing most required template sections, including Purpose, Goals, Approach, tests, security checks, and environment details. Add the missing template sections with brief details for purpose, goals, approach, user stories, docs, tests, security checks, samples, related PRs, and test environment.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title is concise and matches the main change set: logging/configuration updates across Platform API and AI Workspace.
✨ 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.

@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 `@platform-api/src/internal/server/server.go`:
- Around line 807-812: The Platform API startup log is using the wrong slog
attribute key, with `server.go`’s startup message in the `Info` call passing
`"mode="` instead of `"mode"`. Update the `s.logger.Info("Platform API started",
...)` call in `server.go` to use the standard key/value pair format with the
`mode` key so the log renders correctly in both text and JSON output.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e383d0a0-7378-42f2-ad4d-046f1f001119

📥 Commits

Reviewing files that changed from the base of the PR and between 9d300d9 and f85d42a.

📒 Files selected for processing (4)
  • platform-api/src/config/config.go
  • platform-api/src/config/config.toml
  • platform-api/src/internal/logger/logger.go
  • platform-api/src/internal/server/server.go

Comment thread platform-api/src/internal/server/server.go Outdated
- Replaced the console output for server startup with a new function `printStartedMarker` to provide a consistent and decorative banner style.
- Updated the logging to include the mode of operation (PRODUCTION or DEMO) for better clarity during startup.
- Removed the previous `printBanner` function in favor of the new implementation.
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 6, 2026
- Introduced a new logger package to standardize logging across the application.
- Updated configuration to include log level and format options.
- Modified main application to utilize the new logger and load logging settings from the configuration.
- Adjusted TOML mapping to support logging configuration from environment variables.

// Logging
LogLevel string // "debug" | "info" | "warn" | "error" (default "info")
LogFormat string // "text" | "json" (default "text")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

note: new configs for ai workspace

@Thushani-Jayasekera Thushani-Jayasekera changed the title Enhance logging and configuration in platform API [APIP + AIWS] Enhance logging and configuration in platform API Jul 7, 2026
Comment thread platform-api/internal/server/server.go
Comment thread portals/ai-workspace/bff/main.go
@Thushani-Jayasekera
Thushani-Jayasekera merged commit 47eb55b into wso2:main Jul 7, 2026
9 checks passed
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