Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Providers

Logging providers are abstracted by SLF4J and/or EELF.Providers are normally enabled by their presence in the classpath. This means the decision may have been made for you, in some cases implicitly by dependencies. If you have a strong preference then you can change providers, but since the implementation is typically abstracted behind EELF or SLF4J, it may not be worth the effort.

...

Logback is the most commonly used provider. It is generally configured by an XML document named logback.xml. See Configuration. 

Log4j 2.X

Log4j 2.X is somewhat less common than Logback, but equivalent. It is generally configured by an XML document named log4j.xml. See Configuration. 

Log4j 1.X

Log4j Avoid, since 1.X is EOL. See , and since it does not support escaping, so its output may not be machine-readable. See https://logging.apache.org/log4j/1.2/.Avoid, since it does not support escaping, so its output may not be machine-readable.

This affects existing OpenDaylight-based components , primarilylike SDNC and APPC, since it bundles ODL releases prior to Carbon bundle Log4j 1.X, and makes make it very difficult to replace. With OpenDaylight Carbon, the Log4j provider should update to 2.X, The Common Controller SDK Project project targets ODL Carbon, so the problem should resolve in time.

What to Log

The purpose of logging is to capture diagnostic information.

An important aspect of this is analytics, and tracking which requires tracing of requests between components. In a large, distributed system such as ONAP this is critical to understanding behavior and performance. 

...

It isn't really the the purpose of this document to reiterate the basics, so advice here is only general: 

  • Use a logger. Consider using EELF. 
  • Write log messages in English.
  • Write meaningful messages. Consider what will be useful to consumers of logger output. 
  • Write at the appropriate level. Be aware of the volume of logs that will be produced.
  • Log in a machine-readable format. See Conventions.
  • Log for analytics as well as troubleshooting.

...