Skip to content

Each trace record includes an extra message: <program name> <trace level> # #20

@ATECoder

Description

@ATECoder

Serilog Sinks Trace works like a charm but seems to added an extra record before each log message. Is there a way to control this behavior?

To demonstrate, I am showing below the Console log messages (each tagged with a c::) and the Trace messages (each tagged with a t::). The trace messages where stored in a queue, which is dumped for testing purposes.

Here is the Console trace messages:
`
c::20:46:08.731 -08:00, [INF], (isr.Core.Logging.Tester.Program), Starting application...

c::20:46:08.759 -08:00, [INF], (isr.Core.Logging.Tester.App), Running application.

c::20:46:08.803 -08:00, [INF], (isr.Core.Logging.Tester.App), Logging into C:\My\Libraries\VS\Core\Core5\src\Testers\Logging\bin\Debug_Logs\lime_20210210.log.

c::20:46:08.810 -08:00, [DBG], (isr.Core.Logging.Tester.TestService), Running logging service.

c::20:46:08.817 -08:00, [DBG], (isr.Core.Logging.Tester.TestService), Throwing divide by zero exception.

c::20:46:08.835 -08:00, [ERR], (isr.Core.Logging.Tester.App), reporting exception

System.InvalidOperationException: Caught in App

---> System.DivideByZeroException: Attempted to divide by zero.

at isr.Core.Logging.Tester.TestService.Run() in C:\My\Libraries\VS\Core\Core5\src\Testers\Logging\Program\Program.cs:line 309

at isr.Core.Logging.Tester.App.Run() in C:\My\Libraries\VS\Core\Core5\src\Testers\Logging\Program\Program.cs:line 249

--- End of inner exception stack trace ---
`

And here are the trace messages where each line is preceded by the name of the program (LoggingTester) , the trace level (e.g., information) and a zero.

`
--- Queue Trace Listener Records after flush:

LoggingTester Information: 0 :

t::20:40:22.955 -08:00, [INF], (isr.Core.Logging.Tester.Program), Starting application...

LoggingTester Information: 0 :

t::20:40:22.979 -08:00, [INF], (isr.Core.Logging.Tester.App), Running application.

LoggingTester Information: 0 :

t::20:40:23.024 -08:00, [INF], (isr.Core.Logging.Tester.App), Logging into C:\My\Libraries\VS\Core\Core5\src\Testers\Logging\bin\Debug_Logs\lime_20210210.log.

t::20:40:23.031 -08:00, [DBG], (isr.Core.Logging.Tester.TestService), Running logging service.

t::20:40:23.035 -08:00, [DBG], (isr.Core.Logging.Tester.TestService), Throwing divide by zero exception.

LoggingTester Error: 0 :

t::20:40:23.052 -08:00, [ERR], (isr.Core.Logging.Tester.App), reporting exception

System.InvalidOperationException: Caught in App

---> System.DivideByZeroException: Attempted to divide by zero.

at isr.Core.Logging.Tester.TestService.Run() in C:\My\Libraries\VS\Core\Core5\src\Testers\Logging\Program\Program.cs:line 309

at isr.Core.Logging.Tester.App.Run() in C:\My\Libraries\VS\Core\Core5\src\Testers\Logging\Program\Program.cs:line 249

--- End of inner exception stack trace ---

--- End of Queue Trace Listener Records
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions