Log4j2: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 97: | Line 97: | ||
sudo init 6 | sudo init 6 | ||
</source> | |||
<source lang="bash"> | |||
source ~/.bashrc | |||
source ~/.profile | |||
source ~/.bash_profile | |||
</source> | </source> | ||
Revision as of 04:27, 10 March 2021
<?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" includeLocation="true">
<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>
Disable
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<RollingFile name="file" fileName="${finology.log.file}" filePattern="${finology.log.file.gz}" ignoreExceptions="false">
<!-- skipped -->
</RollingFile>
<Console name="console" target="SYSTEM_OUT">
<!-- skipped -->
</Console>
<Async name="async">
<AppenderRef ref="file" level="info"/>
<AppenderRef ref="console" level="off"/>
</Async>
</Appenders>
<Loggers>
<!-- skipped -->
<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>
System
<Property name="academia.log.dir">${sys:user.home}/.chorke/academia/var/log/http</Property>
Environment
#nano ~/.bashrc
#nano ~/.profile
export ACADEMIA_LOG_LEVEL_CLI="off"
export ACADEMIA_LOG_LEVEL_FILE="warn"
export ACADEMIA_WSS="$HOME/chorke/academia"
export ACADEMIA_LOG_PATH="$HOME/.chorke/academia/var/log/http"
sudo init 6
source ~/.bashrc
source ~/.profile
source ~/.bash_profile
<Property name="academia.log.dir">${env:ACADEMIA_LOG_PATH}</Property>
<Property name="academia.log.level.cli">${env:ACADEMIA_LOG_LEVEL_CLI:-info}</Property>
<Property name="academia.log.level.file">${env:ACADEMIA_LOG_LEVEL_FILE:-warn}</Property>