Add Timestamp to Trace.WriteLine()

前端 未结 6 991
甜味超标
甜味超标 2021-01-03 20:37

In my C# .NET application I have an issue with the Trace.WriteLine()-method. I uses this method alot, and want to add a TimeStamp every time I use it.

Instead of Tra

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-03 21:17

    You can set the app.config file to use a timestamp (relative and current time) for all trace listeners using the traceOutputOptions

    traceOutputOptions = "DateTime, Timestamp";
    

提交回复
热议问题