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

    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.

-->
<Configuration status="warn" monitorInterval="10">
    <Properties>
        <Property name="bookkeeper.log.dir">.</Property>
        <Property name="bookkeeper.log.file">bookkeeper-server.log</Property>
        <Property name="bookkeeper.log.root.level">INFO</Property>
        <Property name="bookkeeper.log.root.appender">CONSOLE</Property>
    </Properties>
    <Appenders>
        <!--
            The "%X" pattern element renders the structured attributes attached
            to each log event (slog ".attr(...)" calls and any java.util.MDC /
            Log4j2 ThreadContext entries). It is rendered as "{key=value, ...}".
            Drop or replace it with named keys (e.g. %X{ledgerId}) for a more
            specific format.
        -->
        <Console name="CONSOLE" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m %X%n"/>
        </Console>
        <File name="TRACEFILE" fileName="${sys:bookkeeper.log.dir}/bookkeeper-trace.log">
            <PatternLayout pattern="%d{ISO8601} - %-5p [%t:%C{1}@%L][%ndc] - %m %X%n"/>
        </File>
        <RollingFile name="ROLLINGFILE" fileName="${sys:bookkeeper.log.dir}/${sys:bookkeeper.log.file}" filePattern="${sys:bookkeeper.log.dir}/${sys:bookkeeper.log.file}%d{.yyyy-MM-dd}">
            <PatternLayout pattern="%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m %X%n"/>
            <Policies>
                <TimeBasedTriggeringPolicy modulate="true"/>
            </Policies>
            <DefaultRolloverStrategy max="100"/>
        </RollingFile>
    </Appenders>
    <Loggers>
        <Root level="${sys:bookkeeper.log.root.level}">
            <AppenderRef ref="${sys:bookkeeper.log.root.appender}"/>
        </Root>
    </Loggers>
</Configuration>
