Skip to content

Conversation

@ChristophWurst
Copy link
Member

The PSR-3 logger does not have an equivalent method of our logException, but the specs were written with \Exceptions in mind, hence this is all taken care of: https://www.php-fig.org/psr/psr-3/#13-context.

I've thus changed our adapter so the exception serializer is used for exceptions logged through the PSR adapter.

A prettified exception from this logger:

{
  "reqId": "HDJbNodBnIhn7sTisIbV",
  "level": 0,
  "time": "2020-07-14T07:43:14+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "no app in context",
  "method": "",
  "url": "--",
  "message": {
    "Exception": "Exception",
    "Message": "nonono",
    "Code": 0,
    "Trace": [
      {
        "file": "/home/christoph/workspace/nextcloud/lib/base.php",
        "line": 643,
        "function": "runRegistration",
        "class": "OC\\AppFramework\\Bootstrap\\Coordinator",
        "type": "->",
        "args": []
      },
      {
        "file": "/home/christoph/workspace/nextcloud/lib/base.php",
        "line": 1087,
        "function": "init",
        "class": "OC",
        "type": "::",
        "args": []
      },
      {
        "file": "/home/christoph/workspace/nextcloud/console.php",
        "line": 49,
        "args": [
          "/home/christoph/workspace/nextcloud/lib/base.php"
        ],
        "function": "require_once"
      },
      {
        "file": "/home/christoph/workspace/nextcloud/occ",
        "line": 11,
        "args": [
          "/home/christoph/workspace/nextcloud/console.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/home/christoph/workspace/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php",
    "Line": 81,
    "Previous": {
      "Exception": "Exception",
      "Message": "ok cool",
      "Code": 0,
      "Trace": [
        {
          "file": "/home/christoph/workspace/nextcloud/lib/base.php",
          "line": 643,
          "function": "runRegistration",
          "class": "OC\\AppFramework\\Bootstrap\\Coordinator",
          "type": "->",
          "args": []
        },
        {
          "file": "/home/christoph/workspace/nextcloud/lib/base.php",
          "line": 1087,
          "function": "init",
          "class": "OC",
          "type": "::",
          "args": []
        },
        {
          "file": "/home/christoph/workspace/nextcloud/console.php",
          "line": 49,
          "args": [
            "/home/christoph/workspace/nextcloud/lib/base.php"
          ],
          "function": "require_once"
        },
        {
          "file": "/home/christoph/workspace/nextcloud/occ",
          "line": 11,
          "args": [
            "/home/christoph/workspace/nextcloud/console.php"
          ],
          "function": "require_once"
        }
      ],
      "File": "/home/christoph/workspace/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php",
      "Line": 81
    },
    "CustomMessage": "henlo"
  },
  "userAgent": "--",
  "version": "20.0.0.0"
}

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

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

🎸 🐨 🕶️

@ChristophWurst ChristophWurst added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jul 14, 2020
@ChristophWurst ChristophWurst merged commit 9c209ab into master Jul 14, 2020
@ChristophWurst ChristophWurst deleted the fix/psr3-logger-exception branch July 14, 2020 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish enhancement technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants