Compact-Log-Format-Viewer icon indicating copy to clipboard operation
Compact-Log-Format-Viewer copied to clipboard

Complex properties are not rendered

Open bcallaghan-et opened this issue 6 years ago • 8 comments

Describe the bug Within the properties sub-heading of a selected log message, complex properties are not displayed. The property name is included in the left column, but the right column does not contain any value. Properties that are scalar are rendered appropriately.

To Reproduce Steps to reproduce the behavior:

  1. Create a log file with the following text:
{
  "@t": "2019-12-10T13:33:23.0970926Z",
  "@mt": "An unknown error occurred",
  "@l": "Error",
  "@x": "Exception stack trace",
  "SourceContext": "MySourceContext",
  "Scope": [
    "FirstScope",
    1850562557,
    "198441851"
  ],
  "MachineName": "MY-MACHINE",
  "EnvironmentUserName": "WORKGROUP\\SYSTEM",
  "ExceptionDetail": {
    "HResult": -2146233087,
    "Message": "Internal Error",
    "Source": "System.ServiceModel",
    "Action": null,
    "Code": {
      "IsPredefinedFault": true,
      "IsSenderFault": true,
      "IsReceiverFault": false,
      "Namespace": "http://schemas.xmlsoap.org/soap/envelope/",
      "Name": "Client",
      "SubCode": null
    },
    "Reason": {
      "Translations": [
        {
          "XmlLang": "",
          "Text": "Internal Error"
        }
      ]
    },
    "Type": "System.ServiceModel.FaultException"
  },
  "AssemblyVersion": "2.1.0.1017"
}
{"@t":"2019-12-10T13:33:23.0970926Z","@mt":"An unknown error occurred","@l":"Error","@x":"Exception stack trace","SourceContext":"MySourceContext","Scope":["FirstScope",1850562557,"198441851"],"MachineName":"MY-MACHINE","EnvironmentUserName":"WORKGROUP\\SYSTEM","ExceptionDetail":{"HResult":-2146233087,"Message":"Internal Error","Source":"System.ServiceModel","Action":null,"Code":{"IsPredefinedFault":true,"IsSenderFault":true,"IsReceiverFault":false,"Namespace":"http://schemas.xmlsoap.org/soap/envelope/","Name":"Client","SubCode":null},"Reason":{"Translations":[{"XmlLang":"","Text":"Internal Error"}]},"Type":"System.ServiceModel.FaultException"},"AssemblyVersion":"2.1.0.1017"}
  1. Open this file with Compact Log Viewer
  2. Select the (only) log message to expand it
  3. See that the properties Scope and ExceptionDetail are empty.

Expected behavior The two complex properties should have values displayed in the right column. Since they are complex properties, a JSON rendering would be applicable.

Screenshots The complex properties are highlighted in yellow. Sensitive data has been scrubbed. compact-log-viewer-bug

Desktop (please complete the following information):

  • OS: Windows 10
  • Version: 1803

bcallaghan-et avatar Dec 10 '19 17:12 bcallaghan-et

Hi, I'm in the process of creating Serilog parser for my Log Viewer (https://github.com/philips-software/logviewer) at (https://github.com/Analogy-LogViewer/Analogy.LogViewer.Serilog).

Is this standard log file for Serlilog that I can user as reference?

LiorBanai avatar Dec 10 '19 17:12 LiorBanai

@LiorBanai Serilog can produce files in many different formats, depending on the developer's configuration settings. The log file I posted is in "compact JSON" format. The log viewer in this repository is specifically designed to handle that format. More information on the Compact format can be found at the formatter's repository.

bcallaghan-et avatar Dec 10 '19 18:12 bcallaghan-et

@bcallaghan-et Thanks! I'll look into it :)

LiorBanai avatar Dec 14 '19 17:12 LiorBanai

Best as I can tell, there wasn't support for this at all. I've added some extremely basic support (just an array of first-level key value pairs) in #15

chucker avatar Dec 23 '19 15:12 chucker

I don't want to hijack this thread but I'm not sure how I can message @bcallaghan-et directly..

I just did a small test to see how easy it to parser it. Generic fields of serilog like "@t" are easy. the other I'll match by ui later on. by code I can parse it to the following (plann to have foll Serilog parser later on at https://github.com/Analogy-LogViewer/Analogy.LogViewer.Serilog: poc

LiorBanai avatar Dec 25 '19 17:12 LiorBanai

I can just confirm this one =D

enkelmedia avatar Jan 16 '20 11:01 enkelmedia

Apologies all, I have not been on top of this project as much as I would like to be. Thanks for the feedback & PR I will try & get to this tomorrow :)

warrenbuckley avatar May 21 '20 21:05 warrenbuckley

Merged in the PR from @chucker that helps with some of this 💪

However I am leaving this issue open for now so that we can get the example JSON file in this issue with arrays & nested objects to work no matter how deep with some better recursion, otherwise I would simply forget 🙈

warrenbuckley avatar Jan 24 '22 11:01 warrenbuckley