Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
Mensaje de excepción personalizado de Serilog

Mi tarea actual: necesito eliminar StackTrace del objeto {Exception} en OutputTemplate

 "WriteTo": [ { "Name": "Console", "Args": { "outputTemplate": "[{Timestamp:yyyy:MM:dd hh:mm:ss} {CorrelationId} {Level:u3}] {Message:lj}{NewLine}{Exception}" } }]

El objeto de excepción contiene Mensaje Y StackTrace. Necesito eliminar StackTrace. ¿Es posible?

He probado la propiedad personalizada dentro del Enriquecedor personalizado:

 public class ExceptionEnricherTest : ILogEventEnricher { public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) { if (logEvent.Exception == null) { return; } var logEventProperty = propertyFactory.CreateProperty("ExceptionWithoutStackTrace", logEvent.Exception.Message); logEvent.AddPropertyIfAbsent(logEventProperty); } } public static class LoggingExtensions { public static LoggerConfiguration WithExceptionEnricher( this LoggerEnrichmentConfiguration enrich) { if (enrich == null) throw new ArgumentNullException(nameof(enrich)); return enrich.With<ExceptionEnricherTest>(); } }

Ajustes de aplicaciones en este caso:

 "Enrich": [ "FromLogContext", "WithCorrelationId", "WithExceptionEnricher" ] "WriteTo": [ { "Name": "Console", "Args": { "outputTemplate": "[{Timestamp:yyyy:MM:dd hh:mm:ss} {CorrelationId} {ClientIp} {Level:u3}] {Message:lj}{NewLine}{ExceptionWithoutStackTrace}" } }]

Pero no veo mi propiedad personalizada.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!