3

Im trying to use ILogger the following way,

_logger.LogInformation("Logging info {someClass}", someClass);

But the output is just the object name.

What am I doing wrong here ?

Julian
  • 33,915
  • 22
  • 119
  • 174
Sharthak Ghosh
  • 576
  • 1
  • 9
  • 22
  • Please include the NLog.config. Have you configured `MaxRecursionLimit=10` for the JsonLayout: https://github.com/NLog/NLog/wiki/JsonLayout – Rolf Kristensen Mar 14 '19 at 20:43

1 Answers1

5

You probably like to destruct the class into properties.

That is opt-in, and can be enabled by using the @

So

_logger.LogInformation("Logging info {@someClass}", someClass);

See also: How to use structured logging and the Message templates specs

Julian
  • 33,915
  • 22
  • 119
  • 174