Skip to content

Reduce warning level to warn for some lines#396

Merged
mathieucarbou merged 2 commits into
mainfrom
logging
Mar 8, 2026
Merged

Reduce warning level to warn for some lines#396
mathieucarbou merged 2 commits into
mainfrom
logging

Conversation

@mathieucarbou

@mathieucarbou mathieucarbou commented Mar 7, 2026

Copy link
Copy Markdown
Member

This PR is in relation to #395.

It reduces the log level of some messages from error to warning for these reasons:

  • the logs that are reduced are part of the normal process of the application (like discarding or closing connection when too many messages queued). These are not unrecoverable errors but more warnings to the user of a behavior that might impact his application, because of some external factors.

  • the level reduction also allows users to filter these logs. In example, a user could set ESP_IDF log level to error for async_ws in order to show sow these warnings if he does not care about them (if loss in websocket messages is acceptable, which can be a totally correct use case for an app streaming sensors events). So having these logs in warn allow a user to only log real unrecoverable errors like allocation failures.

  • Reducing log level also helps minimizing the normal logs from the app that goes through the ESP-IDF service forwarding logs to another sublayer (esp_log_set_vprintf(...)) since users can filter normal async_ws logging more easily.

Copilot AI review requested due to automatic review settings March 7, 2026 17:42
@mathieucarbou mathieucarbou self-assigned this Mar 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates logging to reduce severity from error to warning for several recoverable / client-driven conditions, reducing noise in error logs.

Changes:

  • Downgrade “corrupted/invalid file” log from error to warning when responding with 404.
  • Downgrade WebSocket and SSE queue overflow logs from error to warning when dropping messages / closing connections.
  • Downgrade JSON request validation logs (oversized payload, unsupported chunked request) from error to warning.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/WebHandlers.cpp Downgrades invalid/corrupt static file log severity to warning.
src/AsyncWebSocket.cpp Downgrades “too many queued messages” logs to warning.
src/AsyncJson.cpp Downgrades request validation/deserialization-related logs to warning.
src/AsyncEventSource.cpp Downgrades SSE queue overflow logs to warning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mathieucarbou

Copy link
Copy Markdown
Member Author

If one of you guys please approve. Thanks ;-)

@willmmiles willmmiles left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM!

@mathieucarbou mathieucarbou merged commit 04991a7 into main Mar 8, 2026
33 checks passed
@mathieucarbou mathieucarbou deleted the logging branch March 8, 2026 16:36
@me-no-dev

Copy link
Copy Markdown
Member

hmmm... I am not convinced this was a good approach. At least not for all. Please at least write a proper description on why you demote errors.

@mathieucarbou

Copy link
Copy Markdown
Member Author

hmmm... I am not convinced this was a good approach. At least not for all. Please at least write a proper description on why you demote errors.

done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants