Parameterize log4j2 configs

This commit is contained in:
RatzzFatzz
2026-01-15 13:32:35 +01:00
parent cce84f5c15
commit a97ed89d08
7 changed files with 58 additions and 32 deletions

View File

@@ -0,0 +1,49 @@
Configuration:
Properties:
Property:
- name: logDir
value: "./logs"
- name: log_pattern
value: "%d{DEFAULT} | %-5level | %thread | %C{1} | %msg %n %throwable"
Appenders:
Console:
name: Console_Out
PatternLayout:
Pattern: ${log_pattern}
ThresholdFilter:
level: debug
RollingFile:
name: FileAppender
fileName: ${logDir}/application.log
filePattern: ${logDir}/archive/application-%d{yyyy-MM-dd}-%i.log.gz
PatternLayout:
Pattern: logPattern
ThresholdFilter:
level: debug
Policies:
OnStartupTriggeringPolicy:
minSize: 0
DefaultRolloverStrategy:
max: 30
Delete:
basePath: logs/archive
maxDepth: 1
IfLastModified:
age: 30d
IfAccumulatedFileSize:
exceeds: 1GB
Loggers:
Root:
level: debug
AppenderRef:
- ref: Console_Out
- ref: FileAppender
Logger:
name: "com.zaxxer.hikari.HikariConfig"
level: info
AppenderRef:
- ref: Console_Out
- ref: FileAppender