Logging

The Tracing class is the frontend for log4j we use in OLAT. Use Tracing for all logging purposes in OLAT. Examples:

Tracing.logWarn("A warning message...", this.getClass());
If you add debug information you should put an if statement round the debug information like:
if(Tracing.isDebugEnabled(DemoController.class)){
	Tracing.logDebug("link clicked, log something to the olat.log file", DemoController.class);
}
Like this the compiler can optimize calls and you do not get a performance issue while using debugging information in your code.

Be carefull when using Tracing.logError(); In most cases when an error occurs like an ex. IOException it is more appropriate to throw an OLATRuntimeException() and stop to continue with the execution of this thread otherwise the error will let the system crash on an other place where is it often difficult to find the origin reason for the exception.