Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Default configuration

 

The tia® Content Server core Core’s default logging targets are:

  • container-deployment: SYSTEM_OUT Standard out

  • war-deployment: core-of-tia.log file in <web application server>/WEB-INF/<web context>/logs directory.

...

When using container-deployment, it can be required to write logging information to SYSTEM_OUT Standard Out. There it may be read from by monitoring tools.

Info

Hint: Logs written to stdout or stderr may also be viewed by docker command (if using another container runtime, please refer to its documentation):

  • Code Block
    docker container logs <container name or id>

Using this command with option -f allows to watch log file tail continuously.

...

  • tia® Content Server core writes the log file core-of-tia.log into the logs sub directory of the web context directory.

  • At 0:00am and in case the log file exceeds 1GB, it is gz-compressed and renamed to core-of-tia-<n>.log.gz.

  • Up to 10 compressed log files will be kept before removal.

Custom configuration

When requiring custom configuration file, create the logging configuration file and point tia® Content Server core to it using the logging.config parameter.

Control the log level overall by parameter logging.level.root, respective at package granularity by parameter logging.level.<package>.

...

The log level can be configured for the complete product (parameter logging.level.root), or for a special module only (parameter logging.level.<package>).

The log row format, the log location, and other can be configured in a log configuration file (the default file shipped with the product is logback-spring.xml). It is recommended to create a new logging configuration file. Use parameter logging.config to point to the custom configuration file.

Info

The logging framework is SLFJ4-compliant. So for the syntax and options refer to the https://www.slf4j.org/manual.html.

tia Content Server Core uses Logback framework (see https://logback.qos.ch/).

tia Content Server Core parameters for logging:

Parameter

Description

Supported Values

Required

Default value

logging.level.root

Log Level for all logging.

If log level for package is configured, package configuration will overrule.

Recommended for Production is WARN or ERROR.

OFF

ERROR

WARN

INFO

DEBUG

no

DEBUG

logging.level.<package>

Example:

logging.level.com.software.kgs

Definition of the log level for the package.

 

OFF

ERROR

WARN

INFO

DEBUG

no

 

logging.config

Specifies a location for the configuration file of the logging framework.

Info

Hint: When using container-deployment volume mapping maybe required.

Path and filename

no

logback-spring.xml

For more information how to apply these parameters, please read Application wide settings.

...

Info

Recommended in cloud-environments is logging in JSON format, available with tia® Core Content server 3.4.0. To configure JSON logging, set logging.config parameter to value /application/config/json-logback.xml .

Log rotation

In production systems, log files can grow large over time and consume disc space as well. Also handling of large log files for issue analysis is getting more difficult. Log rotation refers to an automatic set up to periodically or on trigger event (like log file exceeds a specified size) copy log files aside and keep only a certain number of copies.

Log rotation can be configured by an appender in the logging configuration file. The logging framework provides the RollingFileAppender (external Log4J link: https://logging.apache.org/log4j/2.x/manual/appenders.html#rollingfileappender, external Logback link: https://logback.qos.ch/manual/appenders.html#RollingFileAppender).

 

...

Note: Utilities like logrotate for Linux (external link: https://linux.die.net/man/8/logrotate) also provide comparable functionality at operating system level.

...

Email notification

Info

tia Content Server 3.9.0 or higher is reuired for this funtionality

The logging in tia ContentServer allows to send mails for errors. This requires an SMTP Server that will forward the mail to the recipient.

You need an additional appender for this (see also https://logback.qos.ch/manual/appenders.html#SMTPAppender) :

First create a logging.xml with an email appender:

Code Block
languagexml
<configuration>
	<property name="baseDir" value="logs" />
	<property name="fileName" value="core-of-tia" />

	<!--Activate this to log also in tomcat std out-->
	<appender name="CONSOLE"
		class="ch.qos.logback.core.ConsoleAppender">
		<encoder>	
			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%32.32X{traceId}/%16.16X{spanId}] [%.-1p] [%20.20thread] %70.70(%30.30logger{10}.%M \(%4L\) ): %m%n</pattern>
		</encoder>
	</appender>
	
    <appender name="emailAppender" class="ch.qos.logback.classic.net.SMTPAppender">
        <smtpHost><yourSMTPHost></smtpHost>
		<smtpPort><yourSMTPPort></smtpPort>
        <!-- one or more recipients are possible -->
        <to>test@test.de</to>
        <from>errorlog@test.de</from>
        <subject>Error occured: %logger{20} - %msg</subject>
        <layout class="ch.qos.logback.classic.PatternLayout">
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg%n</pattern>
        </layout>
    </appender>

	<root level="INFO">
		<appender-ref ref="emailAppender" />
		<appender-ref ref="CONSOLE" />
	</root>
</configuration>

...

For example logging configuration files see: