Skip to content

Instantly share code, notes, and snippets.

@Mpdreamz
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mpdreamz/9fe1e18aca522f50b702 to your computer and use it in GitHub Desktop.
Save Mpdreamz/9fe1e18aca522f50b702 to your computer and use it in GitHub Desktop.
Suggested output for the elasticsearch serilog sink 2.0
try
{
try
{
throw new Exception("inner most exception");
}
catch (Exception e)
{
//NastyInnerException does its own ISerializable.GetObjectData() implementation
var innerException = new NastyException("nasty inner exception", e);
throw new Exception(exceptionMessage, innerException);
}
}
catch (Exception e)
{
logger.Error(e, "Test exception. Should contain an embedded exception object.");
}
{
"@timestamp": "2015-02-24T15:35:35.2725900+01:00",
"level": "Error",
"messageTemplate": "Test exception. Should contain an embedded exception object.",
"message": "Test exception. Should contain an embedded exception object.",
"exceptions": [
{
"Depth": 0,
"ClassName": "System.Exception",
"Message": "test_with_default_serializer",
"Source": "Serilog.Sinks.Elasticsearch.Tests",
"StackTraceString": " at Serilog.Sinks.Elasticsearch.Tests.Discrepancies.ElasticsearchSinkUniformityTestsBase.ThrowAndLogAndCatchBulkOutput(String exceptionMessage) in C:\\Projects\\serilog\\test\\Serilog.Sinks.Elasticsearch.Tests\\Discrepancies\\ElasticsearchSinkUniformityTestsBase.cs:line 35",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": {
"Name": "ThrowAndLogAndCatchBulkOutput",
"AssemblyName": "Serilog.Sinks.Elasticsearch.Tests",
"AssemblyVersion": "1.0.0.0",
"AssemblyCulture": "",
"ClassName": "Serilog.Sinks.Elasticsearch.Tests.Discrepancies.ElasticsearchSinkUniformityTestsBase",
"Signature": "Void ThrowAndLogAndCatchBulkOutput(System.String)",
"MemberType": 8
},
"HResult": -2146233088,
"HelpURL": null
},
{
"Depth": 1,
"ClassName": "classname nasty exception",
"Message": "nasty inner exception",
"Source": "source",
"StackTraceString": "stack trace string",
"RemoteStackTraceString": "remote stack trace string",
"RemoteStackIndex": 1,
"HResult": 123123,
"HelpURL": "help url"
},
{
"Depth": 2,
"ClassName": "System.Exception",
"Message": "inner most exception",
"Source": "Serilog.Sinks.Elasticsearch.Tests",
"StackTraceString": " at Serilog.Sinks.Elasticsearch.Tests.Discrepancies.ElasticsearchSinkUniformityTestsBase.ThrowAndLogAndCatchBulkOutput(String exceptionMessage) in C:\\Projects\\serilog\\test\\Serilog.Sinks.Elasticsearch.Tests\\Discrepancies\\ElasticsearchSinkUniformityTestsBase.cs:line 30",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": {
"Name": "ThrowAndLogAndCatchBulkOutput",
"AssemblyName": "Serilog.Sinks.Elasticsearch.Tests",
"AssemblyVersion": "1.0.0.0",
"AssemblyCulture": "",
"ClassName": "Serilog.Sinks.Elasticsearch.Tests.Discrepancies.ElasticsearchSinkUniformityTestsBase",
"Signature": "Void ThrowAndLogAndCatchBulkOutput(System.String)",
"MemberType": 8
},
"HResult": -2146233088,
"HelpURL": null
}
],
"fields": {
"MachineName": "WIN-DK60SLEMH8C"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment