Log4j2

From Chorke Wiki
Revision as of 03:19, 13 January 2021 by Shahed (talk | contribs)
Jump to navigation Jump to search
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Properties>
        <Property name="academia.log.format">%d{MMM dd, yyyy HH:mm:ss a} %c [METHOD: %M , LINE: %L]%n[%-5p][%t] %m%n</Property>
        <Property name="academia.log.file.gz">${academia.log.dir}/%d{yyyyMM}/SPIDER-%d{yyyyMMdd}-%i.log.gz</Property>
        <Property name="academia.log.dir">${sys:user.home}/.chorke/academia/var/log/http</Property>
        <Property name="academia.log.file">${academia.log.dir}/SPIDER.log</Property>
    </Properties>
    <Appenders>
        <RollingFile name="file" fileName="${academia.log.file}" filePattern="${academia.log.file.gz}" ignoreExceptions="false">
            <PatternLayout pattern="${academia.log.format}"/>
            <Policies>
                <SizeBasedTriggeringPolicy size="10 MB"/>
                <TimeBasedTriggeringPolicy interval="1"/>
                <OnStartupTriggeringPolicy />
            </Policies>
            <DefaultRolloverStrategy max="20"/>
        </RollingFile>
        <Console name="console" target="SYSTEM_OUT">
           <PatternLayout pattern="${academia.log.format}"/>
        </Console>
        <Async name="async">
            <AppenderRef ref="file"/>
            <AppenderRef ref="console"/>
        </Async>
    </Appenders>
    <Loggers>
        <Logger name="org.chorke.academia.http.spider.mapper" level="warn"/>
        <Logger name="springfox.documentation" level="warn"/>
        <Logger name="edu.uci.ics.crawler4j" level="error"/>
        <Logger name="org.apache.activemq" level="warn"/>
        <Logger name="org.chorke.academia" level="info"/>
        <Logger name="org.springframework" level="warn"/>
        <Logger name="org.apache.camel" level="warn"/>
        <Logger name="org.thymeleaf" level="warn"/>
        <Logger name="javax.servlet" level="warn"/>
        <Logger name="bitronix.tm" level="warn"/>
        <Logger name="org.jasypt" level="warn"/>
        <Logger name="org.quartz" level="warn"/>
        <Logger name="com.zaxxer" level="warn"/>

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

Maven

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-slf4j-impl</artifactId>
    <version>2.13.3</version>
</dependency>

References