Log4j2: Difference between revisions
Jump to navigation
Jump to search
(4 intermediate revisions by the same user not shown) | |||
Line 89: | Line 89: | ||
==Environment== | ==Environment== | ||
<source lang="bash"> | <source lang="bash"> | ||
#nano ~/.bashrc | #nano ~/.bashrc | ||
#nano ~/.zshenv | |||
#nano ~/.profile | #nano ~/.profile | ||
#nano ~/.bash_profile | |||
export ACADEMIA_LOG_LEVEL_CLI="off" | export ACADEMIA_LOG_LEVEL_CLI="off" | ||
export ACADEMIA_LOG_LEVEL_FILE="warn" | export ACADEMIA_LOG_LEVEL_FILE="warn" | ||
Line 117: | Line 119: | ||
{| | {| | ||
| valign="top" | | | valign="top" | | ||
* [https://logging.apache.org/log4j/2.x/manual/cloud.html Using | * [https://logging.apache.org/log4j/2.x/manual/cloud.html Log4j2 » Using in Cloud Enabled Applications] | ||
* [https://stackoverflow.com/questions/24140359/ Conditional Property in <code>log4j2.xml</code>] | * [https://stackoverflow.com/questions/24140359/ Log4j2 » Conditional Property in <code>log4j2.xml</code>] | ||
* [https://stackoverflow.com/questions/36996935/ Log4j2 | * [https://stackoverflow.com/questions/36996935/ Log4j2 » Not writing to the RollingFile] | ||
* [https://logging.apache.org/log4j/2.x/manual/configuration.html#PropertySubstitution Log4j2 Property Substitution] | * [https://logging.apache.org/log4j/2.x/manual/configuration.html#PropertySubstitution Log4j2 » Property Substitution] | ||
* [https://logging.apache.org/log4j/2.x/manual/migration.html Log4j2 | * [https://logging.apache.org/log4j/2.x/manual/migration.html Log4j2 » Migrating from Log4j] | ||
* [https://codecooks.com/log4j2-logging-framework/ Log4j2 Logging framework] | * [https://codecooks.com/log4j2-logging-framework/ Log4j2 » Logging framework] | ||
* [https://logging.apache.org/log4j/2.x/ | * [https://logging.apache.org/log4j/2.x/manual/lookups.html#KubernetesLookup Log4j2 » Kubernetes Lookup] | ||
* [https://logging.apache.org/log4j/2.x/ | * [https://logging.apache.org/log4j/2.x/log4j-docker/index.html Log4j2 » Docker Support] | ||
* [https://logging.apache.org/log4j/2.x/manual/lookups.html# | * [https://logging.apache.org/log4j/2.x/manual/lookups.html#DockerLookup Log4j2 » Docker Lookup] | ||
* [https://logging.apache.org/log4j/2.x/manual/ | * [https://logging.apache.org/log4j/2.x/manual/configuration.html Log4j2 » Configuration] | ||
| valign="top" | | |||
* [https://stackoverflow.com/questions/25921723/ Log4j2 » Not displaying the Methods or Line Numbers] | |||
| valign="top" | | |||
|- | |||
| colspan="3" | | |||
---- | |||
|- | |||
| valign="top" | | |||
* [https://stackoverflow.com/questions/16522339/ Logback » Rolling & removing old log files] | |||
* [[Logback]] | |||
* [[WinSW]] | |||
| valign="top" | | |||
| valign="top" | | | valign="top" | | ||
|} | |} |
Latest revision as of 03:25, 9 February 2024
<?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 ~/.zshenv
#nano ~/.profile
#nano ~/.bash_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
source ~/.zshenv
source ~/.zprofile/.zlogin
<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>