Using Log4Net.ErrorFormat how can I log the stacktrace? [duplicate]

大憨熊 提交于 2019-12-23 07:48:24

问题


I would like to use ErrorFormat method because it is easer to read, safer and faster. But I also want to log the exception stacktrace.

I tried log.ErrorFormat("My {0} message", "pretty", exception);

But it only logs "My pretty message" Is it possible to use Error/Debug/Info Format in such way?

Thanks.


回答1:


How about:

log.ErrorFormat("My {0} message: {1}", "pretty", exception);


来源:https://stackoverflow.com/questions/21318945/using-log4net-errorformat-how-can-i-log-the-stacktrace

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!