Versions Compared

Key

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

Excerpt

TDB, seeĀ BITMAG-30@jira Here you can find a description of logging is implemented in the Bitrepository code


We use the SLF4J framework for our logging in the code. Before you start using SLF4J, we highly recommend that you read the two-page SLF4J user manual.

Backend

SLF4J delegates the actual logging to a concrete framework like Log4J, java.commons.logging, etc by adding the related binding jar to the classpath . In this project we use the Log4J successor LogBack.

Formatting

Including variables in the log statement

If the string defined in the log message is dynamic, eg. includes variables or calculations, they should only be generated if the logging is actually going to be performed for the given log statement. This can be achieved by parameterizing the log message with the {} placeholder, eg.

Code Block

log.debug(" Received message was {}", message):

See What is the fastest way of (not) logging? for details

Child pages (Children Display)
excerpttrue
excerptTypesimple