Skip to content

fix(syslog): separate error cause from message in syslog errors - #13974

Open
bhuvan-somisetty wants to merge 1 commit into
apache:masterfrom
bhuvan-somisetty:fix/syslog-error-message-separator
Open

bhuvan-somisetty wants to merge 1 commit into
apache:masterfrom
bhuvan-somisetty:fix/syslog-error-message-separator

Conversation

@bhuvan-somisetty

Copy link
Copy Markdown

Description

send_syslog_data in the syslog plugin concatenated the underlying error directly onto its message, so the batch processor logged run-together text such as failed when initiating the sys logger processorconnection refused or failed to log messagebuffer overflow.

This adds a ": " separator to both messages, consistent with the rest of the code base (e.g. 'failed to loadstring: ' .. err). Only the error strings change; no behavior, return values or config are affected.

A test mocks the socket logger so that log() fails and asserts the error line reads failed to log message: mocked send failure. The other message (logger init failure) shares the same fix, but its test depends on the nil-logger crash fix in #13970, so it is not covered here.

Which issue(s) this PR fixes:

Fixes #13973

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

send_syslog_data concatenated the underlying error straight onto the
message, so logs read "...processorconnection refused". Add a ": "
separator, matching the rest of the code base, and cover the send
failure path with a test.

Fixes apache#13973
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.

bug: syslog error messages run together with the underlying error (missing separator)

1 participant