Enrich business logs for the two exam-sprint report types, OUTLOOK and ACHIEVEMENT, so production issues can be located from report submission through PDF generation, storage, query, download, and cleanup.
The logging enhancement covers these report APIs and application flows:
/api/exam-sprint/outlook-reports and /api/exam-sprint/achievement-reports/api/exam-sprint/outlook-reports/sync and /api/exam-sprint/achievement-reports/sync/api/exam-sprint/reports/{reportId}/api/exam-sprint/reports/{reportId}/downloadThe implementation should not log full request payloads, rendered HTML, PDF bytes, storage credentials, or account keys.
Use focused, structured business logs at application and pipeline boundaries. This keeps the log volume controlled while exposing the information needed to diagnose common failures.
The primary log fields should be:
reportIdreportTypegenerationStatusstagedurationMs where a stage has meaningful elapsed timestorageObjectKey and fileName after upload or download lookupDefaultExamSprintReportApplicationServiceAdd logs around public application operations:
INFO after the report is persisted and submitted to the dispatcher.WARN if dispatch fails and the report is marked failed.INFO when synchronous generation starts.INFO when synchronous generation succeeds and a download URL can be returned.WARN when the generated report is not downloadable.INFO with report status and whether a download URL is included.INFO when an expired report is marked expired during query.INFO on download start and success.WARN when the report is expired, not successful, has no storage key, or storage content is missing.INFO at cleanup summary level with scanned, expired, storage-cleared, and failed counts.WARN for individual cleanup failures while preserving retry behavior.ExamSprintReportGenerationPipelineAdd stage-based logs around generation:
INFO when generation starts for a pending report.INFO when a report is skipped because it is missing, not pending, or expired.INFO when status changes to PROCESSING.INFO after HTML rendering with elapsed time and HTML length.INFO after PDF generation with elapsed time and byte size.INFO after storage upload with elapsed time, storage object key, and file name.INFO after final success with total elapsed time.ERROR when any generation stage fails, including report id, report type, stage, failure reason, and exception.Keep infrastructure logs minimal. Application and pipeline logs should be enough for the normal diagnosis path. Add infrastructure-level logging only if a component has a meaningful failure boundary that is otherwise invisible.
For this change, avoid verbose logs in renderers, PDF generator, and Azure storage unless implementation reveals an unlogged failure path.
DefaultExamSprintReportApplicationService.ExamSprintReport.reportId.ExamSprintReportGenerationPipeline.generate(reportId) directly.PROCESSING, renders HTML, generates PDF bytes, uploads the PDF, and marks the report SUCCESS.FAILED and logs the failed stage.Generation failures should continue to use the existing behavior: catch the exception, persist a failed report with failureReason, and return the failed report where applicable.
The logs should make failure causes observable without changing external API behavior. Expected business states such as expired reports or unavailable downloads should use WARN, while unexpected generation exceptions should use ERROR.
Add or update unit tests where feasible to verify that logging changes do not alter behavior:
OUTLOOK and ACHIEVEMENT report generation paths emit useful logs with reportId and reportType.