Serilog has a convenient way of destructuring objects as shown in this example:
logger.Debug(exception, \"This is an {Exception} text\", exception);
logger.Debug
There's a forum thread discussing this, in which a couple of solutions are presented. Thomas Bolon has created an 'exception destructuring' extension you can find in a Gist.
In this case you use only this syntax:
logger.Debug(exception, "This is an exception");
There's no need to add the exception into the format string.
To ensure the exception is printed to text sinks, just make sure {Exception}
is included in the output template. The standard built-in ones already have this, e.g.:
outputTemplate: "{Timestamp} [{Level}] {Message}{NewLine}{Exception}";