ilscipio/scipio-erp

View on GitHub
framework/base/config/log4j2.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is subject to the terms and conditions defined in the
files 'LICENSE' and 'NOTICE', which are part of this source
code package.
-->
<Configuration monitorInterval="60">
    <!--
      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
      When the ofbiz.log file reaches 1MB in size a new file is created and a date/sequence suffix is added; up to 10 files are kept.
      When the error.log file reaches 1MB in size a new file is created and a date/sequence suffix is added; up to 3 files are kept.
      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-%d{yyyy-MM-dd}-%i.log">
            <PatternLayout pattern="[%level]|%date{DEFAULT} |%-20.20thread |%-30.30logger{1}|%level{length=1}| %message%n"/>
            <Policies>
                <TimeBasedTriggeringPolicy/>
                <SizeBasedTriggeringPolicy size="1 MB"/>
            </Policies>
            <DefaultRolloverStrategy max="10"/>
        </RollingFile>
        <RollingFile name="error" fileName="runtime/logs/error.log"
                     filePattern="runtime/logs/error-%d{yyyy-MM-dd}-%i.log">
            <Filters>
                <ThresholdFilter level="off" onMatch="DENY" onMismatch="NEUTRAL"/><!-- SCIPIO: don't log OFF level in error log -->
                <ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
            </Filters>
            <PatternLayout pattern="%date{DEFAULT} |%-20.20thread |%-30.30logger{1}|%level{length=1}| %message%n"/>
            <Policies>
                <TimeBasedTriggeringPolicy/>
                <SizeBasedTriggeringPolicy size="1 MB"/>
            </Policies>
            <DefaultRolloverStrategy max="3"/>
        </RollingFile>
        <!-- Scipio default socket support -->
        <ScipioSocketAppender name="scipiosocket" channel="log">
            <PatternLayout pattern="%date{DEFAULT} |%-20.20thread |%-30.30logger{1}|%level{length=1}| %message%n"/>
        </ScipioSocketAppender>

        <!-- log4j Socket support (not loaded by default)
        <Socket name="scipiosocketclassic" host="localhost" port="9500">
            <JsonLayout properties="true"/>
            <SSL>
                <KeyStore   location="ofbizcerts.jks" passwordEnvironmentVariable="ofbiz.client.keyStore.password"/>
                <TrustStore location="ofbiztrust.jks"       passwordEnvironmentVariable="ofbiz.trustStore.password"/>
            </SSL>
        </Socket>-->
        <Sentry name="scipiosentry">
            <Filters>
                <ThresholdFilter level="off" onMatch="DENY" onMismatch="NEUTRAL"/><!-- SCIPIO: don't log OFF level in error log -->
                <ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
            </Filters>
        </Sentry>
        <Async name="async">
            <AppenderRef ref="ofbiz"/>
            <AppenderRef ref="stdout"/>
            <AppenderRef ref="error"/>
            <AppenderRef ref="scipiosocket"/>

            <!-- Enable log4j classic socket appender
            <AppenderRef ref="scipiosocketclassic"/>
            -->
            <!-- SCIPIO: Uncomment to enable sentry.io logging - you must set dsn= in sentry.properties for this
            <AppenderRef ref="scipiosentry"/>-->
        </Async>
    </Appenders>
    <Loggers>
        <logger name="org.ofbiz.base.converter.Converters" level="warn"/>
        <logger name="org.apache" level="warn"/>
        <logger name="freemarker" level="warn"/>
        <logger name="FOP" level="warn"/>

        <!-- SCIPIO: filter third-party libraries -->
        <logger name="net.fortuna.ical4j" level="warn"/>

        <!-- SCIPIO: HttpClient debug logging - uncomment to debug Solr connections -->
        <!--<logger name="org.apache.http" level="debug"/>-->

        <!-- SCIPIO: Solr debugging - uncomment to debug Solr itself -->
        <!--<logger name="org.apache.solr" level="debug"/>-->

        <!-- SCIPIO: Scipio Solr general plugins -->
        <logger name="com.ilscipio.scipio.solr.plugin" level="warn"/>

        <!-- SCIPIO: Scipio Solr auth/security plugins -->
        <logger name="com.ilscipio.scipio.solr.plugin.security" level="info"/>

        <!-- SCIPIO: Scipio Camel plugins (max verbosity) 
            NOTE: This is only needed because some Camel superclasses and utilities
            log directly to log4j under our name; otherwise our Scipio code checks the enabled ofbiz log levels (info, verbose, etc.).
            There is a small chance you may need to change these to "warn" on production systems. -->
        <logger name="com.ilscipio.scipio.camel.endpoint" level="info"/>
        <logger name="com.ilscipio.scipio.camel.route" level="info"/>

        <!-- 
            CUSTOM loggers

            To avoid merge conflicts in client projects, custom
            loggers may be defined below this comment.
        -->


        <!-- 
            /CUSTOM loggers (END)
        -->

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