<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" shutdownHook="disable">

  <Properties>
    <Property name="log.path">${sys:app.home}/logs</Property>
    <Property name="log.pattern">%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{actor-name}] [%t] %-5level
      %logger{36} - %msg%n
    </Property>
    <Property name="log.stackdriver.serviceName">${env:ZEEBE_LOG_STACKDRIVER_SERVICENAME:-}
    </Property>
    <Property name="log.stackdriver.serviceVersion">${env:ZEEBE_LOG_STACKDRIVER_SERVICEVERSION:-}
    </Property>
  </Properties>

  <Appenders>
    <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout
        pattern="${log.pattern}"/>
    </Console>

    <Console name="Stackdriver" target="SYSTEM_OUT">
      <StackdriverLayout serviceName="${log.stackdriver.serviceName}"
        serviceVersion="${log.stackdriver.serviceVersion}"/>
    </Console>

    <RollingFile name="RollingFile" fileName="${log.path}/zeebe.log"
      filePattern="${log.path}/zeebe-%d{yyyy-MM-dd}-%i.log.gz">
      <PatternLayout>
        <Pattern>${log.pattern}</Pattern>
      </PatternLayout>
      <Policies>
        <TimeBasedTriggeringPolicy/>
        <SizeBasedTriggeringPolicy size="250 MB"/>
      </Policies>
    </RollingFile>
  </Appenders>

  <Loggers>
    <Logger name="io.camunda.zeebe" level="${env:ZEEBE_LOG_LEVEL:-info}"/>
    <Logger name="io.atomix" level="${env:ATOMIX_LOG_LEVEL:-info}"/>

    <Root level="info">
      <AppenderRef ref="RollingFile"/>

      <!-- remove to disable console logging -->
      <AppenderRef ref="${env:ZEEBE_LOG_APPENDER:-Console}"/>
    </Root>
  </Loggers>

</Configuration>
