KGS Logger Plugin

About

This article describes the KGS Logger Plugin for OSGi based KGS products.

Content

Introduction

Installation

Our gitlab service is creating a jar. This jar is used in our delivered war files. If you have an running tomcat and deployed KGS Logger bundle you can enter the OSGi Bundles view and use the “Install/Update” button in order to upload a newer one.

Configuration

The configuration is made normally by OSGi web interface. But if there is already a configuration you can find the logger configuration also inside the file system.

UI

The log file configuration can be accessed through the OSGi configuration menu:

OSGi → Configuration:

Click on the name “KGS File Logger” or use the edit button to enter the configuration.

The following details may be specified:

 

the values can be adjusted according to the following table:

Field

Meaning

Default

Field

Meaning

Default

Date Time Format

The date format at the beginning of every log line

yyyy-MM-dd HH:mm:ss a

Keep LogFiles (Days)

If you choose the rotation mode 1, the log file is rotated daily. Old files are moved to a sub folder structure with the date. The parameter specifies how long the old log files are stored before they will be deleted.

0

LogFile Size (Mb)

If you choose the rotation mode 2, when the log file gets bigger than the adjusted size the file is renamed to FILENAME.log.bak and a new log file with configured log file name is startet. If there is a old bak file it will be deleted first. This parameter specifies for this option the size when the file is renamed.

10

LogFilename

the name of the log file

Logger.txt

Rotation Mode

valid values are 0,1,2

0 - no rotation at all

1 - “rotate” log => every day a new log file and old log files are moved to a date dependent sub folder hierarchy

2 - “roll” log => if max size is reached, file is renamed to a bak file

1

Synchronous Logging

0 | 1
if 1the OSGi logger does synchronous logging (better for debugging)
if 0 the OSGi logger does asynchronous logging (better for performance)

0

Timezone

used for the logging entries. Used in TimeZone.getTimeZone()
see: https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html#getTimeZone(java.lang.String)

local

WorkingDirectory

where the log files are stored

 

Hide OSGI Framework Logs

prevents not useful osgi framwork logs

true

Hide Method Context

removes the Context: <class> from every log entry

true

File

If you want to edit the log configuration by file, take into acount that the config change takes place only after tomcat restart.

The config located in: $TOMCAT_HOME/webapps/$WEBAPP/conf/logger/KGS File Logger.cfg and look like:

 

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>KGS Admin Bundle Configuration</comment> <entry key="Common.LogFile Size (Mb)">1</entry> <entry key="Common.Synchronous Logging)">true</entry> <entry key="Common.Keep LogFiles (Days)">2</entry> <entry key="Common.Date Time Format">yyyy-MM-dd HH:mm:ss a</entry> <entry key="Common.LogFilename">DocumentRouter.log</entry> <entry key="Common.WorkingDirectory">C:\Program Files\Tomcat9\logs</entry> <entry key="Common.Rotation Mode">1</entry> <entry key="Common.Timezone">local</entry> <entry key="Common.LockGUISave">false</entry> </properties>