Logging

Format

The log entries are structured as follows:

[DATE, format: JJJJ-MM-TT][Time, format: HH-MM-SS][Log level]{Process}[Component][Log message] 

The following log levels are available:

Log Level What? Criticality Action?
DEBUG For debugging only None None
INFO Information None None
WARNING Warning Low Check recommended
ERROR Error High Check required
FATAL Error which caused a process outage Very high Check urgently required

Example

2015-01-13 17:05:19 INFO {main} [ComponentContainerImpl] Starting component 'cache-manager' 

If an error occurs, additional hints are displayed in the form of runtime exceptions which must be checked by the development partner, e.g.:

JPOS display VirtualCustomerLineDisplay: characterSet will not be set!
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:417)
at java.lang.Integer.parseInt(Integer.java:499)
at com.gk_software.pos.hal.device.line_display.JPosLineDisplay.changeCharsetOnDisplay(JPosLineDisplay.java:297)
at com.gk_software.pos.hal.device.line_display.JPosLineDisplay.openDevice(JPosLineDisplay.java:154)
at com.gk_software.pos.hal.common.control.manager.device.AbstractDeviceManager.openDevice(AbstractDeviceManager.java:59)
at com.gk_software.pos.hal.common.control.manager.device.DeviceManagerImpl.activateDevice(DeviceManagerImpl.java:119)
at com.gk_software.pos.hal.common.control.manager.device.MultiInstanceDeviceManagerImpl.activateDevice(MultiInstanceDeviceManagerImpl.java:64)
at com.gk_software.pos.hal.service.hardware_management.HardwareManagementServiceImpl.activateDevice(HardwareManagementServiceImpl.java:66)
at com.gk_software.pos.pos_hal.initialization.AbstractDeviceInitializer.activateEnabledDevices(AbstractDeviceInitializer.java:42)
at com.gk_software.pos.pos_hal.initialization.line_display.LineDisplayDeviceInitializer.initializeDevices(LineDisplayDeviceInitializer.java:61)
at com.gk_software.pos.pos_hal.initialization.PosDeviceInitialization.afterPropertiesSet(PosDeviceInitialization.java:29)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at gk.spring_ext.component.impl.ComponentImpl.start(ComponentImpl.java:66)
at gk.spring_ext.component.impl.ComponentContainerImpl.startComponentInternal(ComponentContainerImpl.java:656)
at gk.spring_ext.component.impl.ComponentContainerImpl.startComponents(ComponentContainerImpl.java:285)
at gk.spring_ext.component.impl.ComponentContainerImpl.afterPropertiesSet(ComponentContainerImpl.java:227)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.gk_software.pos.Main.startApp(Main.java:79)
at com.gk_software.pos.Main.main(Main.java:42)

Log files are permanently written. As soon as a defined file size is reached, the log files are packed and later deleted.

Activation

Configuration file <POS_SERVICE_ROOT>/config/parameter/logging.properties:

# GK Logging Appender
appender.root.enabled=true
appender.root.file=root-appender.xml

Location for Outputs

An application directory will be defined during installation. This application directory includes a /log directory which is used to store the log files.

In Apache Tomcat environments, it is possible to view or change this directory:

<GKRETAIL_ROOT_FOLDER>/tomcat/conf/Catalina/localhost/pos-service.xml 

The default value for the storage location of the log file is e.g. under Linux (Tomcat):

/usr/local/gkretail/pos-service/log

Configuration File Name, Max. File Size, etc.

The following log file is written:

  • /log/pos-service.log: Contains logs for cash register, EFT and Loyalty Engine

File name:

  • An unpacked log file has the following format: pos-service.log
  • Packed log files have the following format: pos-service.log-[JJJJMMDD].gz

There are several parameters to influence the storage duration, file size, etc.:

  • maxBytes: Max. file size in bytes. If it is exceeded, the file is packed and a new file is created.
  • maxCount: Max. number of files. If it is exceeded, the files are deleted.
  • maxAge: Max. age of files (in days). If it is exceeded, the corresponding files are deleted.

Configuration file:

<POS_SERVICE_ROOT>/config/parameter/root-appender.xml:

<param name="maxBytes" value="50485760" />
<param name="maxCount" value="1000" />
<param name="maxAge" value="15d" />

Configuration of Outputted Log Levels

The log level can be set differently for the individual components. Therefore, it can be defined whether outputs of a particular category (=level) are written or not.

The following log levels are available:

  • TRACE
  • DEBUG
  • INFO
  • WARNING
  • ERROR
  • FATAL

If INFO is set, all messages of the level INFO and higher are outputted.

OFF disables the logging completely.

Configuration file:

<POS_SERVICE_ROOT>/config/parameter/logging.properties, e.g.:

# HAL
log.level.com.gk_software.pos.hal=DEBUG
log.level.com.gk_software.pos.pos_hal.input=DEBUG
log.level.gk.cashterminal=DEBUG
log.level.gk.javapos=DEBUG
# remoting
log.level.org.apache.cxf=OFF
# commons http client
log.level.httpclient.wire=DEBUG
log.level.org.apache.commons.httpclient=DEBUG
# http client - svs
log.level.org.apache.http.impl.conn=DEBUG
log.level.org.apache.http.impl.client=DEBUG
log.level.org.apache.http.client=DEBUG
#ui - xml printouts
log.level.com.gk_software.pos.ui=OFF
log.level.com.gk_software.pos.ui.swing.service=OFF
log.level.com.gk_software.pos.ui.swing.adapter=INFO

Log Output on the Console

In the configuration file <POS_SERVICE_ROOT>/config/parameter/logging.properties, it is possible to set the messages which are displayed on the console.

In Tomcat, these messages are written to the Tomcat log. Messages are not redirected to this log, by default. The values for the setting are:

  • true = Output suppressed
  • false = Output allowed

Configuration file:

<POS_SERVICE_ROOT>/config/parameter/logging.properties:

drop.appender.GK_STDOUT.enabled=true
drop.appender.GK_STDERR.enabled=true