Skip to content
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

Move exception logging to separate field #27451

Merged
merged 1 commit into from
Jun 10, 2021
Merged

Conversation

juliusknorr
Copy link
Member

This is a proposal to adjust the log format when exceptions are logged to move them to a separate field in the log json output. The current approach basically leads to the message field being either a string or an object which always bugged me a bit as it is not a unified format. This would also allow easier extraction for some log collection solutions when storing the log details in elastic search for example.

As it is a breaking change on the format we'd need to properly document that in the changelog.

Any oppinions @ChristophWurst @nickvergessen @MorrisJobke @skjnldsv @kesselb

Before:

{
  ...
  "message": {
    "Exception": "Exception",
    "Message": "Unauthorized",
    "Code": 0,
    "Trace": [
      ....
    ],
    "File": "/var/www/html/apps-extra/sharepoint/vendor/vgrem/php-spo/src/Runtime/OData/ODataRequest.php",
    "Line": 51,
    "CustomMessage": "--"
  }
}

After:

{
  ...
  "message": "Unauthorized",
  "exception": {
    "Exception": "Exception",
    "Message": "Unauthorized",
    "Code": 0,
    "Trace": [
      ...
    ],
    "File": "/var/www/html/apps-extra/sharepoint/vendor/vgrem/php-spo/src/Runtime/OData/ODataRequest.php",
    "Line": 51,
    "CustomMessage": "--"
  }
}

Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliusknorr juliusknorr added enhancement 3. to review Waiting for reviews labels Jun 10, 2021
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

Fine by me :)

@ChristophWurst ChristophWurst added the pending documentation This pull request needs an associated documentation update label Jun 10, 2021
Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

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

Makes sense 👍

@MorrisJobke MorrisJobke merged commit c0e1238 into master Jun 10, 2021
@MorrisJobke MorrisJobke deleted the enh/log-exception branch June 10, 2021 08:10
@MorrisJobke MorrisJobke added this to the Nextcloud 22 milestone Jun 10, 2021
@MorrisJobke MorrisJobke mentioned this pull request Jun 10, 2021
59 tasks
@juliusknorr
Copy link
Member Author

Do we have any place to mention noticable changes for admins in the changelog for example? Maybe something for @jospoortvliet ?

@juliusknorr
Copy link
Member Author

Documentation pr in nextcloud/documentation#6764

@juliusknorr juliusknorr removed the pending documentation This pull request needs an associated documentation update label Jun 10, 2021
@nickvergessen
Copy link
Member

Do we have any place to mention noticable changes for admins in the changelog for example?

#26407

@juliusknorr
Copy link
Member Author

Ah also about admins, ok then I'll add to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants