How to log stack trace using log4net (C#)

前端 未结 5 1611
[愿得一人]
[愿得一人] 2020-12-01 21:06

How to log stack trace with log4net? I am using .Net version.

They way I have is Log.Error(ex).

Thanks

5条回答
  •  粉色の甜心
    2020-12-01 21:39

    You need to ensure that the definition of the layout pattern is structured to output what format and data you want.

    log4Net Pattern Layout

    Used to output the stack trace of the logging event The stack trace level specifier may be enclosed between braces. For example, %stacktrace{level}. If no stack trace level specifier is given then 1 is assumed

    Output uses the format: type3.MethodCall3 > type2.MethodCall2 > type1.MethodCall1

    This pattern is not available for Compact Framework assemblies.

提交回复
热议问题