mirror of
https://github.com/tiennm99/store-scraper-bot-java.git
synced 2026-06-05 04:14:13 +00:00
feat(loki): send logs to loki to centralize logs
This commit is contained in:
@@ -17,6 +17,11 @@ JAVA_OPTS=-Xmx512m
|
||||
# Logging configuration
|
||||
LOG_LEVEL=INFO
|
||||
|
||||
LOKI_HOST=logs-prod-020.grafana.net
|
||||
LOKI_PORT=443
|
||||
LOKI_USERNAME=your_loki_username
|
||||
LOKI_PASSWORD=your_loki_password
|
||||
|
||||
# App configuration
|
||||
ENV=DEVELOPMENT
|
||||
ADMIN_IDS=1000001999,1000002000,1000002001
|
||||
|
||||
@@ -24,6 +24,7 @@ configurations {
|
||||
dependencies {
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.36")
|
||||
implementation("com.couchbase.client:java-client:3.7.6")
|
||||
implementation("com.fasterxml.jackson.core:jackson-databind:2.18.2")
|
||||
implementation("com.google.code.gson:gson:2.11.0")
|
||||
implementation("com.google.guava:guava:33.4.0-jre")
|
||||
implementation("org.apache.commons:commons-math3:3.6.1")
|
||||
@@ -32,6 +33,7 @@ dependencies {
|
||||
implementation("org.telegram:telegrambots-client:8.0.0")
|
||||
implementation("org.telegram:telegrambots-extensions:8.0.0")
|
||||
implementation("org.telegram:telegrambots-longpolling:8.0.0")
|
||||
implementation("pl.tkowalcz.tjahzi:log4j2-appender:0.9.32")
|
||||
|
||||
testAnnotationProcessor("org.projectlombok:lombok:1.18.36")
|
||||
testImplementation(platform("org.junit:junit-bom:5.11.4"))
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
<Properties>
|
||||
<Property name="CONSOLE_LOG_PATTERN">%d{HH:mm:ss.SSS} %5p --- [%t] %c : %m%n</Property>
|
||||
<Property name="CONSOLE_LOG_CHARSET">UTF-8</Property>
|
||||
<Property name="LOKI_LOG_PATTERN">%d{yyyy-MM-dd HH:mm:ss.SSS} %5p --- [%t] %c : %m%n</Property>
|
||||
<Property name="LOKI_LOG_CHARSET">UTF-8</Property>
|
||||
</Properties>
|
||||
|
||||
<Appenders>
|
||||
@@ -12,10 +14,24 @@
|
||||
<ThresholdFilter level="TRACE"/>
|
||||
</Filters>
|
||||
</Console>
|
||||
|
||||
<Loki name="Loki">
|
||||
<host>${env:LOKI_HOST}</host>
|
||||
<port>${env:LOKI_PORT}</port>
|
||||
|
||||
<username>${env:LOKI_USERNAME}</username>
|
||||
<password>${env:LOKI_PASSWORD}</password>
|
||||
|
||||
<PatternLayout pattern="${LOKI_LOG_PATTERN}" charset="${LOKI_LOG_CHARSET}"/>
|
||||
|
||||
<Label name="service_name" value="StoreScraperBot"/>
|
||||
<Label name="environment" value="${env:ENV}"/>
|
||||
</Loki>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="${env:LOG_LEVEL:-debug}">
|
||||
<AppenderRef ref="ConsoleAppender"/>
|
||||
<AppenderRef ref="Loki"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
||||
Reference in New Issue
Block a user