-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: optimize the discovery inject logic and fix nacos config not working issue * feat: 删除无用的导入 * feat: 增加actuator到demo中 * fix: add lossless healthcheck for example * fix: add configuration comments * fix: 修复事件日志不输出的问题
- Loading branch information
1 parent
7bc4c23
commit 5bafa35
Showing
4 changed files
with
402 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
144 changes: 102 additions & 42 deletions
144
...lugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/resources/polaris-log4j.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,103 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> | ||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> | ||
<appender name="POLARIS_LOG_FILE" class="org.apache.log4j.RollingFileAppender"> | ||
<param name="File" value="${polaris.log.home}/polaris.log"/> | ||
<param name="Append" value="true"/> | ||
<param name="MaxBackupIndex" value="10"/> | ||
<param name="MaxFileSize" value="10MB"/> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param name="ConversionPattern" | ||
value="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%-5p] [method:%l]%n%m%n%n"/> | ||
</layout> | ||
</appender> | ||
<appender name="POLARIS_UPDATE_EVENT_LOG_FILE" class="org.apache.log4j.RollingFileAppender"> | ||
<param name="File" value="${polaris.log.home}/polaris-update-event.log"/> | ||
<param name="Append" value="true"/> | ||
<param name="MaxBackupIndex" value="10"/> | ||
<param name="MaxFileSize" value="10MB"/> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param name="ConversionPattern" | ||
value="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%-5p] [method:%l]%n%m%n%n"/> | ||
</layout> | ||
</appender> | ||
<appender name="POLARIS_UPDATE_EVENT_LOG_FILE_ASYNC" class="org.apache.log4j.AsyncAppender"> | ||
<param name="BufferSize" value="512"/> | ||
<param name="Blocking" value="false"/> | ||
<appender-ref ref="POLARIS_UPDATE_EVENT_LOG_FILE"/> | ||
</appender> | ||
|
||
<logger name="com.tencent.polaris" additivity="false"> | ||
<level value="INFO"/> | ||
<appender-ref ref="POLARIS_LOG_FILE"/> | ||
</logger> | ||
<logger name="polaris-update-event" additivity="false"> | ||
<level value="INFO"/> | ||
<appender-ref ref="POLARIS_UPDATE_EVENT_LOG_FILE"/> | ||
</logger> | ||
<logger name="polaris-update-event-async" additivity="false"> | ||
<level value="INFO"/> | ||
<appender-ref ref="POLARIS_UPDATE_EVENT_LOG_FILE_ASYNC"/> | ||
</logger> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> | ||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> | ||
<appender name="POLARIS_LOG_FILE" class="org.apache.log4j.RollingFileAppender"> | ||
<param name="File" value="${polaris.log.home}/polaris.log"/> | ||
<param name="Append" value="true"/> | ||
<param name="MaxBackupIndex" value="10"/> | ||
<param name="MaxFileSize" value="10MB"/> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param name="ConversionPattern" | ||
value="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%-5p] [method:%l]%n%m%n%n"/> | ||
</layout> | ||
</appender> | ||
<appender name="POLARIS_UPDATE_EVENT_LOG_FILE" class="org.apache.log4j.RollingFileAppender"> | ||
<param name="File" value="${polaris.log.home}/polaris-update-event.log"/> | ||
<param name="Append" value="true"/> | ||
<param name="MaxBackupIndex" value="10"/> | ||
<param name="MaxFileSize" value="10MB"/> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param name="ConversionPattern" | ||
value="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%-5p] [method:%l]%n%m%n%n"/> | ||
</layout> | ||
</appender> | ||
<appender name="POLARIS_UPDATE_EVENT_LOG_FILE_ASYNC" class="org.apache.log4j.AsyncAppender"> | ||
<param name="BufferSize" value="512"/> | ||
<param name="Blocking" value="false"/> | ||
<appender-ref ref="POLARIS_UPDATE_EVENT_LOG_FILE"/> | ||
</appender> | ||
<appender name="POLARIS_CIRCUIT_BREAKER_EVENT_LOG_FILE" | ||
class="org.apache.log4j.RollingFileAppender"> | ||
<param name="File" value="${polaris.log.home}/polaris-circuitbreaker-event.log"/> | ||
<param name="Append" value="true"/> | ||
<param name="MaxBackupIndex" value="10"/> | ||
<param name="MaxFileSize" value="10MB"/> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param name="ConversionPattern" | ||
value="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%-5p] [method:%l]%n%m%n%n"/> | ||
</layout> | ||
</appender> | ||
<appender name="POLARIS_HEALTH_CHECK_EVENT_LOG_FILE" | ||
class="org.apache.log4j.RollingFileAppender"> | ||
<param name="File" value="${polaris.log.home}/polaris-healthcheck-event.log"/> | ||
<param name="Append" value="true"/> | ||
<param name="MaxBackupIndex" value="10"/> | ||
<param name="MaxFileSize" value="10MB"/> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param name="ConversionPattern" | ||
value="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%-5p] [method:%l]%n%m%n%n"/> | ||
</layout> | ||
</appender> | ||
<appender name="POLARIS_LOSSLESS_EVENT_LOG_FILE" | ||
class="org.apache.log4j.RollingFileAppender"> | ||
<param name="File" value="${polaris.log.home}/polaris-lossless-event.log"/> | ||
<param name="Append" value="true"/> | ||
<param name="MaxBackupIndex" value="10"/> | ||
<param name="MaxFileSize" value="10MB"/> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param name="ConversionPattern" | ||
value="%m|[%d{yyyy-MM-dd HH:mm:ss:SSS}]%n"/> | ||
</layout> | ||
</appender> | ||
<appender name="POLARIS_INSTANCE_HEARTBEAT_LOG_FILE" | ||
class="org.apache.log4j.RollingFileAppender"> | ||
<param name="File" value="${polaris.log.home}/polaris-instance-heartbeat.log"/> | ||
<param name="Append" value="true"/> | ||
<param name="MaxBackupIndex" value="10"/> | ||
<param name="MaxFileSize" value="10MB"/> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param name="ConversionPattern" | ||
value="%m|[%d{yyyy-MM-dd HH:mm:ss:SSS}]%n"/> | ||
</layout> | ||
</appender> | ||
|
||
<logger name="com.tencent.polaris" additivity="false"> | ||
<level value="INFO"/> | ||
<appender-ref ref="POLARIS_LOG_FILE"/> | ||
</logger> | ||
<logger name="polaris-update-event" additivity="false"> | ||
<level value="INFO"/> | ||
<appender-ref ref="POLARIS_UPDATE_EVENT_LOG_FILE"/> | ||
</logger> | ||
<logger name="polaris-update-event-async" additivity="false"> | ||
<level value="INFO"/> | ||
<appender-ref ref="POLARIS_UPDATE_EVENT_LOG_FILE_ASYNC"/> | ||
</logger> | ||
<logger name="polaris-circuitbreaker-event" additivity="false"> | ||
<level value="INFO"/> | ||
<appender-ref ref="POLARIS_CIRCUIT_BREAKER_EVENT_LOG_FILE"/> | ||
</logger> | ||
<logger name="polaris-healthcheck-event" additivity="false"> | ||
<level value="INFO"/> | ||
<appender-ref ref="POLARIS_HEALTH_CHECK_EVENT_LOG_FILE"/> | ||
</logger> | ||
<logger name="polaris-lossless-event" additivity="false"> | ||
<level value="INFO"/> | ||
<appender-ref ref="POLARIS_LOSSLESS_EVENT_LOG_FILE"/> | ||
</logger> | ||
<logger name="polaris-instance-heartbeat" additivity="false"> | ||
<level value="INFO"/> | ||
<appender-ref ref="POLARIS_INSTANCE_HEARTBEAT_LOG_FILE"/> | ||
</logger> | ||
</log4j:configuration> |
188 changes: 139 additions & 49 deletions
188
...ugins/spring-cloud-plugins/spring-cloud-2023-plugin/src/main/resources/polaris-log4j2.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,142 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<Configuration status="WARN"> | ||
<Appenders> | ||
<RollingFile name="POLARIS_LOG_FILE" fileName="${sys:polaris.log.home}/polaris.log" | ||
filePattern="${sys:polaris.log.home}/polaris.log.%d{yyyy-MM-dd}.%i"> | ||
<PatternLayout> | ||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</Pattern> | ||
</PatternLayout> | ||
|
||
<Policies> | ||
<TimeBasedTriggeringPolicy/> | ||
<SizeBasedTriggeringPolicy size="${sys:polaris.log.file.size:-10MB}"/> | ||
</Policies> | ||
|
||
<DefaultRolloverStrategy max="${sys:polaris.log.retain.count:-7}"/> | ||
</RollingFile> | ||
|
||
<RollingFile name="POLARIS_UPDATE_EVENT_LOG_FILE" | ||
fileName="${sys:polaris.log.home}/polaris-update-event.log" | ||
filePattern="${sys:polaris.log.home}/polaris-update-event.log.%d{yyyy-MM-dd}.%i"> | ||
<PatternLayout> | ||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</Pattern> | ||
</PatternLayout> | ||
|
||
<Policies> | ||
<TimeBasedTriggeringPolicy/> | ||
<SizeBasedTriggeringPolicy size="${sys:polaris-update-event.log.file.size:-10MB}"/> | ||
</Policies> | ||
|
||
<DefaultRolloverStrategy max="${sys:polaris-update-event.log.retain.count:-7}"/> | ||
</RollingFile> | ||
</Appenders> | ||
|
||
<Loggers> | ||
<Logger name="com.tencent.polaris" | ||
level="${sys:polaris.log.level:-info}" | ||
additivity="false"> | ||
<AppenderRef ref="POLARIS_LOG_FILE"/> | ||
</Logger> | ||
<Logger name="polaris-update-event-async" | ||
level="${sys:polaris-update-event.log.level:-info}" | ||
additivity="false"> | ||
<AppenderRef ref="POLARIS_UPDATE_EVENT_LOG_FILE"/> | ||
</Logger> | ||
<!-- <AsyncLogger name="polaris-update-event-async"--> | ||
<!-- level="${sys:polaris-update-event.log.level:-info}"--> | ||
<!-- additivity="false">--> | ||
<!-- <AppenderRef ref="POLARIS_UPDATE_EVENT_LOG_FILE"/>--> | ||
<!-- </AsyncLogger>--> | ||
</Loggers> | ||
</Configuration> | ||
<Appenders> | ||
<Console name="Console" target="SYSTEM_OUT"> | ||
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> | ||
</Console> | ||
<RollingFile name="POLARIS_LOG_FILE" fileName="${sys:polaris.log.home}/polaris.log" | ||
filePattern="${sys:polaris.log.home}/polaris.log.%d{yyyy-MM-dd}.%i"> | ||
<PatternLayout> | ||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</Pattern> | ||
</PatternLayout> | ||
|
||
<Policies> | ||
<TimeBasedTriggeringPolicy/> | ||
<SizeBasedTriggeringPolicy size="${sys:polaris.log.file.size:-10MB}"/> | ||
</Policies> | ||
|
||
<DefaultRolloverStrategy max="${sys:polaris.log.retain.count:-7}"/> | ||
</RollingFile> | ||
|
||
<RollingFile name="POLARIS_UPDATE_EVENT_LOG_FILE" | ||
fileName="${sys:polaris.log.home}/polaris-update-event.log" | ||
filePattern="${sys:polaris.log.home}/polaris-update-event.log.%d{yyyy-MM-dd}.%i"> | ||
<PatternLayout> | ||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</Pattern> | ||
</PatternLayout> | ||
|
||
<Policies> | ||
<TimeBasedTriggeringPolicy/> | ||
<SizeBasedTriggeringPolicy size="${sys:polaris.update.event.log.file.size:-10MB}"/> | ||
</Policies> | ||
|
||
<DefaultRolloverStrategy max="${sys:polaris.update.event.log.retain.count:-7}"/> | ||
</RollingFile> | ||
|
||
<RollingFile name="POLARIS_CIRCUIT_BREAKER_EVENT_LOG_FILE" | ||
fileName="${sys:polaris.log.home}/polaris-circuitbreaker-event.log" | ||
filePattern="${sys:polaris.log.home}/polaris-circuitbreaker-event.log.%d{yyyy-MM-dd}.%i"> | ||
<PatternLayout> | ||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</Pattern> | ||
</PatternLayout> | ||
|
||
<Policies> | ||
<TimeBasedTriggeringPolicy/> | ||
<SizeBasedTriggeringPolicy | ||
size="${sys:polaris.circuitbreaker.event.log.file.size:-10MB}"/> | ||
</Policies> | ||
|
||
<DefaultRolloverStrategy max="${sys:polaris.circuitbreaker.event.log.retain.count:-7}"/> | ||
</RollingFile> | ||
|
||
<RollingFile name="POLARIS_HEALTH_CHECK_EVENT_LOG_FILE" | ||
fileName="${sys:polaris.log.home}/polaris-healthcheck-event" | ||
filePattern="${sys:polaris.log.home}/polaris-healthcheck-event.log.%d{yyyy-MM-dd}.%i"> | ||
<PatternLayout> | ||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</Pattern> | ||
</PatternLayout> | ||
|
||
<Policies> | ||
<TimeBasedTriggeringPolicy/> | ||
<SizeBasedTriggeringPolicy | ||
size="${sys:polaris.healthcheck.event.log.file.size:-10MB}"/> | ||
</Policies> | ||
|
||
<DefaultRolloverStrategy max="${sys:polaris.healthcheck.event.log.retain.count:-7}"/> | ||
</RollingFile> | ||
|
||
<RollingFile name="POLARIS_LOSSLESS_EVENT_LOG_FILE" | ||
fileName="${sys:polaris.log.home}/polaris-lossless-event" | ||
filePattern="${sys:polaris.log.home}/polaris-lossless-event.log.%d{yyyy-MM-dd}.%i"> | ||
<PatternLayout> | ||
<Pattern>%m|%d{yyyy-MM-dd HH:mm:ss.SSS}%n</Pattern> | ||
</PatternLayout> | ||
|
||
<Policies> | ||
<TimeBasedTriggeringPolicy/> | ||
<SizeBasedTriggeringPolicy | ||
size="${sys:polaris.lossless.event.log.file.size:-10MB}"/> | ||
</Policies> | ||
|
||
<DefaultRolloverStrategy max="${sys:polaris.lossless.event.log.retain.count:-7}"/> | ||
</RollingFile> | ||
|
||
<RollingFile name="POLARIS_INSTANCE_HEARTBEAT_LOG_FILE" | ||
fileName="${sys:polaris.log.home}/polaris-instance-heartbeat" | ||
filePattern="${sys:polaris.log.home}/polaris-instance-heartbeat.log.%d{yyyy-MM-dd}.%i"> | ||
<PatternLayout> | ||
<Pattern>%m|%d{yyyy-MM-dd HH:mm:ss.SSS}%n</Pattern> | ||
</PatternLayout> | ||
|
||
<Policies> | ||
<TimeBasedTriggeringPolicy/> | ||
<SizeBasedTriggeringPolicy | ||
size="${sys:polaris.instance.heartbeat.log.file.size:-10MB}"/> | ||
</Policies> | ||
|
||
<DefaultRolloverStrategy max="${sys:polaris.instance.heartbeat.log.retain.count:-7}"/> | ||
</RollingFile> | ||
</Appenders> | ||
|
||
<Loggers> | ||
<Root level="info"> | ||
<AppenderRef ref="Console"/> | ||
</Root> | ||
<Logger name="com.tencent.polaris" | ||
level="${sys:polaris.log.level:-info}" | ||
additivity="false"> | ||
<AppenderRef ref="POLARIS_LOG_FILE"/> | ||
</Logger> | ||
<Logger name="polaris-update-event-async" | ||
level="${sys:polaris.update.event.log.level:-info}" | ||
additivity="false"> | ||
<AppenderRef ref="POLARIS_UPDATE_EVENT_LOG_FILE"/> | ||
</Logger> | ||
<Logger name="polaris-circuitbreaker-event" | ||
level="${sys:polaris.circuitbreaker.event.log.level:-info}" | ||
additivity="false"> | ||
<AppenderRef ref="POLARIS_CIRCUIT_BREAKER_EVENT_LOG_FILE"/> | ||
</Logger> | ||
<Logger name="polaris-healthcheck-event" | ||
level="${sys:polaris.healthcheck.event.log.level:-info}" | ||
additivity="false"> | ||
<AppenderRef ref="POLARIS_HEALTH_CHECK_EVENT_LOG_FILE"/> | ||
</Logger> | ||
<!-- <AsyncLogger name="polaris-update-event-async"--> | ||
<!-- level="${sys:polaris-update-event.log.level:-info}"--> | ||
<!-- additivity="false">--> | ||
<!-- <AppenderRef ref="POLARIS_UPDATE_EVENT_LOG_FILE"/>--> | ||
<!-- </AsyncLogger>--> | ||
<Logger name="polaris-lossless-event" | ||
level="${sys:polaris.lossless.event.log.level:-info}" | ||
additivity="false"> | ||
<AppenderRef ref="POLARIS_LOSSLESS_EVENT_LOG_FILE"/> | ||
</Logger> | ||
<Logger name="polaris-instance-heartbeat" | ||
level="${sys:polaris.instance.heartbeat.log.level:-info}" | ||
additivity="false"> | ||
<AppenderRef ref="POLARIS_INSTANCE_HEARTBEAT_LOG_FILE"/> | ||
</Logger> | ||
</Loggers> | ||
</Configuration> |
Oops, something went wrong.