Fork me on GitHub

Logging rule

Lutece logs

Lutece property files :
  • application.log contains the main events of the application : loading of services,plugins, etc
  • error.log contains unexpected events.

Exception handling

All exceptions must be written in a log file.

The catch blocks must never be empty and should not call for e.printStackTrace()

Non critical exceptions

The exception which does not require stopping the undergoing processing must be logged in the following way

catch( Exception e )
{
    AppLogService.error( e.getMessage() , e );
}         

Critical exceptions

The exceptions requiring the stopping of the processing (examples : SQL error, file access error ...) must be throw an exception issued from LuteceException. (PhysicalException , ClientException...). The class LuteceException handles itself log writing. The catch block is treated as follows :

catch( Exception e )
{
    throw new PhysicalException( e.getMessage() , plugin.getName() , e );
}         

Application exception

The application exceptions, such as UserActionException, are the only ones which need not being logged because they are used in normal execution of the application.