View source | Discuss this page | Page history | Printable version   
Main Page
Upload file
What links here
Recent changes

PDF Books
Add page
Show collection (0 pages)
Collections help


How To Configure Log

Bulbgraph.png   log4j2 is introduced in Openbravo since PR19Q1. If you're using a previous version of Openbravo, please refer to How_To_Configure_Log_Using_Log4j1.x to configure log using log4j 1.x.



Logging allows developers to insert messages when code is executed, these messages can be used to understand different issues in the backend code, such as errors, performance problems, etc.

Starting from PR19Q1, Openbravo uses log4j2 to log.


Logging is configured using 3 log configuration files, depending on the scenario:


Typically log is redirected to a file. This file is determined by the <RollingFile> tag inside the <Appenders> section. The defaults are:

<RollingFile name="RollingFile" fileName="${logDir}/openbravo.log"
<PatternLayout pattern="%d [%t] %-5p %c - %m%n"/>
    <TimeBasedTriggeringPolicy />
    <SizeBasedTriggeringPolicy size="100MB" />
  <DefaultRolloverStrategy max="30"/>

With this configuration, regular log will be placed in openbravo.log file in tomcat's log directory.

Log Verbosity

Verbosity in the log is defined by the log levels:


Developer decides which is the level of each of the messages sent to the log.

It is possible to configure the log to display messages starting from any of these levels. Default configuration shows INFO and above. Log level can be configured globally and/or per class/package.

This can be modified in 2 ways:

  <!-- Setting default log level as debug -->
  <Root level="debug">
  <!-- Setting logger to debug level -->
  <!-- can refer either to a class or a package fully qualified name -->
  <Logger name="" level="debug"/>
Bulbgraph.png   Note that this logger will inherit the appenders used by the parent logger (Root in most cases). If you want to change this behavior, you should add the additivity attribute and set it to false. See Log4j2 documentation for more details.



In order to prevent log file to constantly increase, rotation is defined. Rotation sets up the policy to decide when log file will be archived and how many archives will be maintained.

It is configured with the following properties in <RollingFile> section:

  <TimeBasedTriggeringPolicy />
  <SizeBasedTriggeringPolicy size="100MB" />
<DefaultRolloverStrategy max="30"/>

By default, log file is limited to 100MB size and will be archived and compressed daily and/or when log exceeds 100MB. The number of log files stored is limited to 30 and when exceeded the older one will be removed.

For more info about the Rolling File Appender see Log4j2 documentation.

Retrieved from ""

This page has been accessed 18,327 times. This page was last modified on 14 November 2018, at 13:25. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.