Projects:LogClient Externalization/Specs
Contents |
Overview
Log Client (also known as Terminal Log), is a log generated by the POS and other mobile applications. These log events are synchronized and persisted in the backend. By default those logs are stored in a Database table (`OBMOBC_LogClient`).
The purpose of this project is to extend the TerminalLogLoader in order to be able to change the way the log is persisted.
TerminalLogLoader extension
TerminalLogLoader will save the TerminalLog batch of events as an ImportEntry as usual, but later when the ImportEntry is processed, we will use a TerminalLogEventPersistor instance that is injected via Weld that will implement the way we want to persist this log.
By default, StoreTerminalLogEventInDatabase will be used. This subclass persists the events in the obmobc_logclient database. If you want to use another persistor class, just implement a subclass of TerminalLogEventPersistor and assign it a priority below 100.
TerminalLog File persistor
This project also created the module [https://gitlab.com/openbravo/product/pmods/org.openbravo.logclient.externalization|org.openbravo.logclient.externalization] that extends the TerminalLogLoader by defining another persistor with higher priority that saves log events to a file using log4j2 infrastructure.
To use this, after installing this module, you must add the configuration of the new logger in log4j2-web.xml. You can find instructions about the suggested configuration in the module's README file.
Log format
TerminalLog events are saved in the logfile as a single-line string with fields separated by spaces. All fields that may contain whitespaces such as the Organization name, the log message or the context, are scaped and wrapped in double quotes.
For more details, see formatAsStringSeparatedBySpaces in TerminalLogEvent class.