Skip to content

Improve error logging #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 11, 2023
Merged

Improve error logging #177

merged 3 commits into from
Jul 11, 2023

Conversation

mrtus
Copy link
Contributor

@mrtus mrtus commented Jul 7, 2023

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Describe the solution you've provided

Various logging tools can generate a stack trace based on the exception being on the 'exception' key in the logging context. See PSR-3

Describe alternatives you've considered

We could keep the debug log but since this introduces duplicate logging and does not provide a browsable context of the exception, it is better to remove this.

I am a bit conflicted about keeping $e->getMessage() as part of the error message, since this becomes redundant with the same reason as before, many logging tools simply use the exception on the logging context already and use it as a message.

mrtus added 2 commits July 7, 2023 16:46
By logging the exception on the context various logging tools can generate a stack trace
@mrtus mrtus marked this pull request as ready for review July 7, 2023 14:52
@louis-launchdarkly
Copy link
Contributor

Hello @mrtus, thank you for the contribution. We will review this and get back to you after that.

Filed Internally as 209083.

@keelerm84 keelerm84 changed the base branch from main to contrib July 11, 2023 17:03
@keelerm84 keelerm84 merged commit baa271d into launchdarkly:contrib Jul 11, 2023
LaunchDarklyReleaseBot added a commit that referenced this pull request Jul 12, 2023
## [5.1.1] - 2023-07-11
### Changed:
- Invalid context log message now includes the flag key as part of the
Psr\Log context. (Thanks,
[mrtus](#179)!)
- Error logging now includes the exception in the Psr\Log exception
context key. (Thanks,
[mrtus](#177)!)

---------

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: hroederld <46500128+hroederld@users.noreply.github.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: elliot <elliot@debian.elliot>
Co-authored-by: Elliot Haisley <35050275+Apache-HB@users.noreply.github.com>
Co-authored-by: Harpo Roeder <hroeder@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com>
Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com>
Co-authored-by: Matthew M. Keeler <keelerm84@gmail.com>
Co-authored-by: charukiewicz <charukiewicz@protonmail.com>
Co-authored-by: Joey Malinowski <joemalin95@gmail.com>
Co-authored-by: Christian Charukiewicz <christian@foxhound.systems>
Co-authored-by: Matthew M. Keeler <mkeeler@launchdarkly.com>
Co-authored-by: Colin Henwood <aretenz@users.noreply.github.com>
Co-authored-by: Colin Henwood <colin.henwood@xero.com>
Co-authored-by: Eli Bishop <35503443+eli-darkly@users.noreply.github.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: ld-repository-standards[bot] <113625520+ld-repository-standards[bot]@users.noreply.github.com>
Co-authored-by: Kane Parkinson <93555788+kparkinson-ld@users.noreply.github.com>
Co-authored-by: Michiel Devriese <michieldevriese@gmail.com>
@keelerm84
Copy link
Member

Released in 5.1.1

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.

3 participants