Serilog - Output/Enrich All Messages with MethodName from which log entry was Called

后端 未结 5 1758
面向向阳花
面向向阳花 2020-12-02 16:24

Is there anyway to enrich all Serilog output with the Method Name.

For Instance consider If I have the following;

Public Class MyClassName

  Privat         


        
5条回答
  •  难免孤独
    2020-12-02 16:29

    In outputTemplate for the Serilog , configure for logs to write Properties. Method name will be written as part of ActionName column.

    ActionName can also be configured individually (instead of all properties) in outputTemplate.

    Configuring Properties/ActionName will write the method name in Namespace.ClassName.MethodName format.

提交回复
热议问题