Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to modify specific property value (compress stacktrace property of exception) of object logged using serilog.

public class CustomEnricher : ILogEventEnricher
    {
        public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
        {
            var errorContainer = logEvent.Properties["errorDetails"];
        }
    }

In the above code, i m getting the log message in errorContainer (LogEventPropertyValue type).

But not able to access the particular property which i want to modify.

Basically im logging the exception and want to compress stackTrace property of exception before logging.

Can a property be modified using Enricher ?

Is there any alternate solution for this ?

What I have tried:

I tried looking at existing enrichers but nowhere found enricher that is modifying existing value.
Posted
Comments
[no name] 16-Jun-21 2:37am    
You need to create a property in the enricher for the compressed stack trace.

https://wwwlicious.com/servicestack-exception-enricher-for-serilog/
Member 11568448 16-Jun-21 11:50am    
how can we remove the existing stacktrace from logging ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900