Logging in the Torque generator

The Torque generator uses logging to visualize the work it is doing at the moment. It commons-logging as logging abstraction, so in principle, it is logging-framework agnostic.

However, the loglevel of the Torque generator can be changed by its configuration. This is because it is typically a hassle to configure the logging framework in the build tools where the torque generator is normally running. The ability to set the loglevel is not provided by commons-logging, therefore an adapter (an implementation of org.apache.torque.generator.configuration.controller.LoggingAdapter) is used.

Natively, the Torque generator contains two implementations:

  • A log4j adapter which reads and sets the current loglevel by reading and changing the level of log4j's root logger (org.apache.torque.generator.configuration.controller.Log4jLoggingAdapter).
  • A dummy adapter which implements the LoggingAdapter interface but cannot read or change a log level (org.apache.torque.generator.configuration.controller.DummyLoggingAdapter).

The adapter can be changed at runtime by calling the static method setLoggingAdapter(LoggingAdapter) of the class org.apache.torque.generator.configuration.controller.Loglevel. By default, the Log4jLoggingAdapter is used.