this code:
try
{
...
...
}
catch (Exception ex)
{
logger.Error(ex); // v1
logger.Error(ex.ToString); // v2
logger.Error(ex.ToString()); // v3
logger.Error("Message: " + ex); // v4
}
Will not log full stack trace in v1
scenario. Instead - only message will be logged. I think this is weird. Why there is a difference between ex
, and ex.ToString()
? I thought, that using ex
should be the same as ex.ToString()
in logging.