问题
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