<configuration debug="false">
  <statusListener class="ch.qos.logback.core.status.NopStatusListener" />

  <!-- a path and a prefix -->
  <property name="logfile-base" value="${LOGBASE}/metrics-web-" />

  <!-- log file names -->
  <property name="fileall-logname" value="${logfile-base}all" />
  <property name="fileerr-logname" value="${logfile-base}err" />
  <property name="filestatistics-logname" value="${logfile-base}statistics" />

  <!-- date pattern -->
  <property name="utc-date-pattern" value="%date{ISO8601, UTC}" />

  <!-- appender section -->
  <appender name="FILEALL" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${fileall-logname}.log</file>
    <encoder>
      <pattern>${utc-date-pattern} %level %logger{20}:%line %msg%n</pattern>
    </encoder>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <!-- rollover daily -->
      <FileNamePattern>${fileall-logname}.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
      <maxHistory>10</maxHistory>
      <timeBasedFileNamingAndTriggeringPolicy
            class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
        <!-- or whenever the file size reaches 1MB -->
        <maxFileSize>1MB</maxFileSize>
      </timeBasedFileNamingAndTriggeringPolicy>
    </rollingPolicy>
  </appender>

  <appender name="FILEERR" class="ch.qos.logback.core.FileAppender">
    <file>${fileerr-logname}.log</file>
    <encoder>
      <pattern>${utc-date-pattern} %level %logger{20}:%line %msg%n</pattern>
    </encoder>

    <!-- ERROR or worse -->
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
      <level>ERROR</level>
    </filter>
  </appender>

  <!-- logger section -->
  <logger name="org.torproject" >
    <appender-ref ref="FILEERR" />
  </logger>

  <logger name="org.eclipse" level="INFO" />
  <logger name="org.apache" level="INFO" />

  <root level="ALL">
    <appender-ref ref="FILEALL" />
  </root>

</configuration>

