GuidesChangelogData Inspector Library API Reference
Guides

Data Client Library logging

Data Client Library logging

The Data Client Library uses Pekko Logging to deliver high performance and asynchronous logging without adding new dependencies.

To choose a specific logging SLF4J compatible backend, add the configuration below to your application.conf. In your runtime, you also need a SLF4J backend. For more information, see the official SLF4J documentation on the availability of logging backend implementations SL4FJ.

pekko {
  # This is the minimum log level for events forwarded by Pekko to the slf4j logger.
  # The slf4j backend configuration can define a higher log level in its configuration (for instance, in logback.xml or in log4j.xml).
  loglevel = "DEBUG"
  loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"]
  logging-filter = "org.apache.pekko.event.slf4j.Slf4jLoggingFilter"
  logger-startup-timeout = 1m
}

Logback

To enable logging with Logback, add the logback dependency to your project.

libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3"
<dependency>
  <groupId>ch.qos.logback</groupId>
  <artifactId>logback-classic</artifactId>
  <version>1.2.3</version>
</dependency>
dependencies {
  compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
}

Add the corresponding log configuration to your project.

<configuration>

    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%date{ISO8601} %-5level %msg%n</pattern>
        </encoder>
    </appender>

    <logger name="com.here.platform.data.client" level="info" />

    <root level="info">
        <appender-ref ref="console" />
    </root>
</configuration>

Log4j

To enable logging with Log4j, add the log4j dependency to your project.

libraryDependencies += "org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.10.0"
libraryDependencies += "org.apache.logging.log4j" % "log4j-api" % "2.10.0"
<dependencies>
  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-slf4j-impl</artifactId>
    <version>2.10.0</version>
  </dependency>
  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.10.0</version>
  </dependency>
</dependencies>
dependencies {
  compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.10.0'
  compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.10.0'
}

Add the corresponding log configuration to your project.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </Console>
    </Appenders>
    <Loggers>
        <Logger name="com.here.platform.data.client" level="info" />
        <Root level="info">
            <AppenderRef ref="Console"/>
        </Root>
    </Loggers>
</Configuration>