Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

log4net

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.

like image 573
Fernando Avatar asked Jan 23 '14 20:01

Fernando


1 Answers

How about:

log.ErrorFormat("My {0} message: {1}", "pretty", exception);
like image 191
Joe Avatar answered Oct 19 '22 19:10

Joe