Configure the logging provided by individual yuuvis® Momentum services.
Table of Contents
Introduction
Logs provide information on processes within individual instances of services that are running in the yuuvis® Momentum cluster. Their outputs are managed and provided via Kubernetes. The log level can be configured in order to show more or less process details. The configuration can be adjusted during the installation process, but also for systems that are already in operation.
Hierarchical Configuration
The logging can be configured hierarchically by means of the underlying java package structure. In this article, the placeholder <packageName>
is used. If it is replaced by a specific class (e.g., com.os.services.package.subpackage.MyFirstExampleClass
), only the configuration for the logging provided by this class is affected. If it is replaced by a package name at a higher hierarchical level (e.g., com.os.services
), all classes included in the package are affected.
Configuration Possibilities
Service Deployment during Installation
In the individual service configuration YAML files, the log level can be configured during installation. The desired log level can be specified in the value for the JAVA_OPTS
parameter via -D
as shown in the example code block below.
spec.template.spec.containers: - env: - name: JAVA_OPTS value: -XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0 -Dlogging.level.com.os.services=DEBUG
To specify multiple logging configurations, separate them with a space as shown in the following example:
spec.template.spec.containers: - env: - name: JAVA_OPTS value: -XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0 -Dlogging.level.com.os.services.package.subpackage.MyFirstExampleClass=DEBUG -Dlogging.level.com.os.services.package.subpackage.MySecondExampleClass=DEBUG
Configuration Files of Running Systems
The logging configuration for yuuvis® Momentum systems that are already in operation can be adjusted via profile-specific configuration files.
>> Configuring Services using Profiles
Specify the log level in the <serviceName>-prod.yml
configuration file in order to configure it for the service that reads the file. The following line, e.g., activates the DEBUG
log level:
logging.level.com.os.services: DEBUG
The target service has to be refreshed or restarted in order to activate the new logging configuration.
'/*/manage/loggers/**' Endpoints
The logger management endpoints are accessible only for users with specific authorization as defined in the authentication-prod.yml file and controlled by the AUTHENTICATION Service.
Retrieving Information on Loggers
It is possible to retrieve an overview of all loggers that are defined for a specific service via the GET endpoint http://<ip>:<port>/manage/loggers
. For each logger, the current log level is displayed as shown in the example response body.
Updating Log Levels
In order to set a log level at runtime, it can be specified in JSON format as shown in the example below and sent as request body to the POST endpoint http://<ip>:<port>/manage/loggers/<packageName>
.
The change applies immediately to the service instance running on the target port. After a restart of this service, the log level is reset to the value configured in a configuration file as described before.
Summary
The configuration of log levels can be adjusted in the service deployment during the installation. For a system in operation, the logging can be configured in configuration files or via an endpoint.