Skip to content

Configuration

Aleksander edited this page Aug 27, 2019 · 14 revisions

Table of Contents

LogBlock is based on logback package.
We will use logback.xml for configuration. But you can use any other way of configuring, supported by logback (see Logback configuration)

Basic configuration

As described in quick start guide, you should specify the encoder com.github.sidssids.blocklogger.encoder.BlockloggerPatternLayoutEncoder:

<encoder class="com.github.sidssids.blocklogger.encoder.BlockloggerPatternLayoutEncoder" />

Encoder settings

The encoder extends default PatternLayoutEncoder, so you can use any its configuration. There are extra properties:

  • profiling - is a boolean value, used to enable\disable profiling information, attached to the closing block message.

    Default value: true
  • appendParams - is a boolean value, used to enable\disable params information, attached to the starting block message.
    Default value: true
  • appendResult - is a boolean value, used to enable\disable report information, attached to the closing block message.
    Default value: true
  • appendExceptionInfo - is a boolean value, used to enable\disable exception information, attached to the closing block message.
    Default value: true
  • appendStackTrace - is a boolean value, used to enable\disable exception stack trace after the closing block message.
    Default value: true
  • indentEnabled - is a boolean value, used to enable\disable indentation.
    Default value: true
  • tabString - is a string value, used as indent
    Default value: ' ' (4 spaces)

Configuration example:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="com.github.sidssids.blocklogger.encoder.BlockloggerPatternLayoutEncoder">
            <pattern>%d [%-10thread] %-5level %msg%n</pattern>
            <profiling>true</profiling>
            <appendParams>true</appendParams>
            <appendResult>true</appendResult>
            <appendExceptionInfo>false</appendExceptionInfo>
            <appendStackTrace>false</appendStackTrace>
            <indentEnabled>true</indentEnabled>
            <tabString>|---</tabString>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="CONSOLE" />
    </root>
</configuration>
Clone this wiki locally