cnelsonakgov / serilog-sinks-azureapp

A Serilog sink that supports Azure App Services 'Diagnostics logs' and 'Log stream' features.
Creative Commons Zero v1.0 Universal
17 stars 2 forks source link

double information output when using ExpressionTemplate #14

Open tecxx opened 1 year ago

tecxx commented 1 year ago

hello,

using an ExpressionTemplate to show only class name of SourceContext:

var logExpressionTemplate = new ExpressionTemplate(theme: Serilog.Templates.Themes.TemplateTheme.Literate,
        template: "[{@t:HH:mm:ss} {@l:u3} {Substring(SourceContext, LastIndexOf(SourceContext, '.') + 1)}] {@m}\n{@x}");
    builder.Host.UseSerilog((hostingContext, loggerConfig) => loggerConfig.ReadFrom.Configuration(hostingContext.Configuration)
            .WriteTo.Console(logExpressionTemplate)
            .WriteTo.AzureApp(logExpressionTemplate)

while the console correctly outputs image

i get this in azure log stream: image

time, severity type and full classname are printed before the formatted text. how can i avoid that?

Eric-Johnston22 commented 2 months ago

I'm experiencing the same issue. If you use: WriteTo.File(), the .txt logs in the deployed app will also have the double output.