Logging

Log4j2 Logging

KonaKart uses standard log4j2 logging. (Prior to version 8.7.0.0 KonaKart used log4j).

The KonaKart engines search for logging properties files in the following order on the classpath:

  1. If not null the file defined by the System property "kk.log4j.configuration"

  2. If not null the file defined by the System property "log4j.configuration"

  3. konakart-logging.xml

  4. log4j2.xml

  5. log4j2.json

  6. log4j2.properties

If none of the above are found on the classpath no logging is explicitly set by KonaKart.

Logging can be enabled for selected parts of the system and the level of the logging tuned as required. Use the following logging levels:

  • ERROR
  • WARN
  • INFO
  • DEBUG

"DEBUG" logging will show the most detail.

The logging configuration file "konakart-logging.xml" contains a set of the most commonly-used KonaKart logging settings. Simply edit this file to modify the logging level of the subsystem you need logging for. (You will find the file under the classes directories of both the konakart and konakartadmin webapps - e.g. webapps/konakart/WEB-INF/classes)

A very common example is to set the logging to display SQL that is being executed by KonaKart. You do this by setting the following:


<!-- KonaKart Persistence layer - Set to INFO to see the SQL 
     (Set to TRACE to see more detail) -->
     
<Logger name="com.konakart.db" level="INFO" additivity="false">
    <AppenderRef ref="STDOUT"/>
</Logger>

Logging changes will take effect without needing to restart your application server so long as you have set the monitorInterval attribute in your logging configuration file to a number greater than 0 (the default is 100 so logging settings are refreshed within 100 seconds of changes being made to logging configuration files).