feat(log): 优化日志输出 增加ip和hostname全名

This commit is contained in:
2024-02-01 17:38:54 +08:00
parent ba24b4e5a6
commit 2fa18fa4f8
4 changed files with 7 additions and 5 deletions

View File

@@ -6,6 +6,8 @@
<springProperty scope="context" name="LOKI_PUSH_URL" source="loki.url"/>
<springProperty scope="context" name="LOGGING_PARENT" source="logging.parent"/>
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
<springProperty scope="context" name="DEPLOY_HOSTNAME" source="deploy.hostname"/>
<springProperty scope="context" name="DEPLOY_IP" source="deploy.ip"/>
<appender name="Loki" class="com.github.loki4j.logback.Loki4jAppender">
<metricsEnabled>true</metricsEnabled>
@@ -14,7 +16,7 @@
</http>
<format>
<label>
<pattern>app=${APP_NAME:-none},host=${HOSTNAME:-none},level=%level</pattern>
<pattern>app=${APP_NAME:-none},host=${DEPLOY_HOSTNAME:-none},ip=${DEPLOY_IP:-none},level=%level</pattern>
<readMarkers>true</readMarkers>
</label>
<message>