What should I log?

  • It is necessary to log all http requests centrally
  • It is necessary to log all exceptions centrally
  • You need to log all the arguments of the application services
  • It is necessary to log all customer arguments
  • It is necessary to log the branching of logic (in the branching itself or after it)
  • Any other logs at the discretion of the developer

Logging levels

  • ERROR – an error has definitely occurred
  • WARN – an error may have occurred
  • INFO – usually logs at the beginning of functions
  • DEBUG – usually logs in the middle and at the end of functions
  • TRACE – logging of big data

The normal log level is DEBUG, so in practice you rarely have to think about what to put in INFO and what to put in DEBUG.

Where should I log in?

You need to log in to stdout, no files are needed.

Then it would be good if these logs were collected in some system. For example, Kibana.