Skip to main content

Logback custom converters

Atoti provides three Logback converters you can register in your logback.xml to enrich log patterns with server-specific context.
ConverterDescription
com.activeviam.tech.logging.logback.spring.api.LogUserConverterDisplays the current user for the thread (from the security layer or the health event).
com.activeviam.tech.logging.logback.api.LogThreadConverterDisplays the current thread; useful for health events. Can override the default Logback %thread.
com.activeviam.tech.logging.logback.api.LogInstanceConverterRequired only for ELK/JSON-log setups: provides the node instance name (from atoti.server.node.instance.name, default atoti) so the source node of a log can be identified in a centralized logging system.
The example below registers all three converters and uses %thread and %user in an appender pattern.
<?xml version="1.0" encoding="UTF-8"?>
{/* Example LOGBACK Configuration File http://logback.qos.ch/manual/configuration.html */}
<configuration>
    <shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
    <jmxConfigurator/>
    {/* Exposing the conversion rules */}
    <conversionRule conversionWord="thread"
                    converterClass="com.activeviam.tech.logging.logback.api.LogThreadConverter"/>
    <conversionRule conversionWord="user"
                    converterClass="com.activeviam.tech.logging.logback.spring.api.LogUserConverter"/>

    <appender name="MAIN" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${custom.log.dir}/${project.artifactId}.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${custom.log.dir}/${project.artifactId}_%d{yyyy-MM-dd}.log.gz
            </fileNamePattern>
            <maxHistory>30</maxHistory>
            <cleanHistoryOnStart>true</cleanHistoryOnStart>
        </rollingPolicy>

        <encoder>
            {/* Using the converter in the appender pattern layout */}
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [Thread: %thread; User: %user] %-5level %logger{35} -
                %msg%n
            </pattern>
        </encoder>
    </appender>
    [...]
    <root level="INFO">
        <appender-ref ref="MAIN"/>
    </root>
    <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
        <resetJUL>true</resetJUL>
    </contextListener>
</configuration>

Blocked-thread watchdog

The blocked-thread watchdog is an opt-in component that periodically scans for blocked JVM threads. When it detects a change in the blocked-thread count, it logs a summary on the atoti.server.monitoring.health logger and writes a full thread dump on the atoti.server.monitoring.health.blocked-thread logger. The watchdog is disabled by default because a full thread dump is verbose. Enable it only when you need to diagnose lock contention.
PropertyDefaultDescription
atoti.server.monitoring.blockedThreadWatchdog.enabledfalseSet to true to activate the watchdog.
atoti.server.monitoring.blockedThreadWatchdog.scanIntervalMs60000Interval in milliseconds between scans. Only applies when the watchdog is enabled.

Loggers per modules

Check the logger documentation of the component you want to monitor:

Composer loggers (Atoti Technical Modules)

There are loggers available in the Atoti generic technical modules. They are used in a lot of places in Atoti Server. Here is the exhaustive list of the loggers available in the Atoti Composer:
  • atoti.server.tech
    • atoti.server.tech.aggregation
    • atoti.server.tech.arrow
    • atoti.server.tech.bitmap
    • atoti.server.tech.chunks
      • atoti.server.tech.chunks.allocation
      • atoti.server.tech.chunks.compression
      • atoti.server.tech.chunks.creation
    • atoti.server.tech.code-generation
    • atoti.server.tech.concurrency
      • atoti.server.tech.concurrency.fence
      • atoti.server.tech.concurrency.numa
      • atoti.server.tech.concurrency.stop-watch
      • atoti.server.tech.concurrency.threads
    • atoti.server.tech.condition
    • atoti.server.tech.dictionary
    • atoti.server.tech.formatter
    • atoti.server.tech.jdbc
    • atoti.server.tech.jmx
    • atoti.server.tech.memory
    • atoti.server.tech.mvcc
    • atoti.server.tech.observability
      • atoti.server.tech.observability.health-event
    • atoti.server.tech.partitioning
    • atoti.server.tech.property
    • atoti.server.tech.records
    • atoti.server.tech.registry
    • atoti.server.tech.timings
    • atoti.server.tech.utilities
    • atoti.server.tech.vector