<?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 monitorInterval="60" packages="org.apache.ofbiz.base.log4j">
    <OFBizDynamicThresholdFilter key="uri" onMatch="ACCEPT" onMismatch="DENY">
        <KeyValuePair key="/getJs" value="ERROR"/>
        <KeyValuePair key="/control/getJs" value="ERROR"/>
    </OFBizDynamicThresholdFilter>
    <!--
      Default configuration for logging; for customizations refer to
      http://logging.apache.org/log4j/2.x/manual/configuration.html.

      With this configuration the following behavior is defined:
       * all log messages of severity "warning" or greater, generated by external jars, are logged in the ofbiz.log file
         and in the console
       * all log messages of any severity, generated by OFBiz, are logged in the ofbiz.log file and in the console
       * all log messages of severity "error" or greater are also logged in the error.log file

      Log file ofbiz.log is configured to rollover when it reaches 10MB in size, and to keep up to 30 rolled over files.
      Log file error.log is configured to rollover when it reaches 10MB in size, and to keep up to 10 rolled over files.

      The settings in this configuration file can be changed without restarting the instance: every 60 seconds the file
      is checked for modifications.
    -->
    <Appenders>
        <Console name="stdout" target="SYSTEM_OUT">
            <PatternLayout pattern="%date{DEFAULT} |%-20.20thread |%-30.30logger{1}|%level{length=1}| %message%n"/>
        </Console>

        <RollingFile name="ofbiz" fileName="runtime/logs/ofbiz.log" filePattern="runtime/logs/ofbiz.log.%i">
            <PatternLayout pattern="%date{DEFAULT} |%-20.20thread |%-30.30logger{1}|%level{length=1}| %message%n"/>
            <Policies>
                <OnStartupTriggeringPolicy/>
                <SizeBasedTriggeringPolicy size="10 MB"/>
            </Policies>
            <DefaultRolloverStrategy fileIndex="min" max="30"/>
        </RollingFile>

        <RollingFile name="error" fileName="runtime/logs/error.log" filePattern="runtime/logs/error.log.%i">
            <ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
            <PatternLayout pattern="%date{DEFAULT} |%-20.20thread |%-30.30logger{1}|%level{length=1}| %message%n"/>
            <Policies>
                <OnStartupTriggeringPolicy/>
                <SizeBasedTriggeringPolicy size="10 MB"/>
            </Policies>
            <DefaultRolloverStrategy fileIndex="min" max="10"/>
        </RollingFile>

        <Async name="async">
            <AppenderRef ref="ofbiz"/>
            <AppenderRef ref="stdout"/>
            <AppenderRef ref="error"/>
        </Async>
    </Appenders>

    <Loggers>
        <logger name="org.apache" level="warn"/>
        <logger name="org.apache.ofbiz" level="all"/>
        <logger name="org.apache.ofbiz.base.converter.Converters" level="warn"/>
        <logger name="freemarker" level="warn"/>

        <Root level="all">
            <AppenderRef ref="async"/>
        </Root>
    </Loggers>
</Configuration>
