瀏覽代碼

Regroup packages related to logging into a separate module and polish document (#1355)

master
Jason Joo GitHub 4 年之前
父節點
當前提交
df683b8716
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 11 個檔案被更改,包括 30 行新增17 行删除
  1. +1
    -0
      pom.xml
  2. +0
    -1
      sentinel-extension/pom.xml
  3. +18
    -0
      sentinel-logging/pom.xml
  4. +8
    -13
      sentinel-logging/sentinel-logging-slf4j/README.md
  5. +3
    -3
      sentinel-logging/sentinel-logging-slf4j/pom.xml
  6. +0
    -0
      sentinel-logging/sentinel-logging-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogLogger.java
  7. +0
    -0
      sentinel-logging/sentinel-logging-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogLogger.java
  8. +0
    -0
      sentinel-logging/sentinel-logging-slf4j/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.log.Logger
  9. +0
    -0
      sentinel-logging/sentinel-logging-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogTest.java
  10. +0
    -0
      sentinel-logging/sentinel-logging-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogTest.java
  11. +0
    -0
      sentinel-logging/sentinel-logging-slf4j/src/test/resources/log4j2.xml

+ 1
- 0
pom.xml 查看文件

@@ -76,6 +76,7 @@
<module>sentinel-demo</module>
<module>sentinel-benchmark</module>
<module>sentinel-cluster</module>
<module>sentinel-logging</module>
</modules>

<dependencyManagement>


+ 0
- 1
sentinel-extension/pom.xml 查看文件

@@ -22,7 +22,6 @@
<module>sentinel-datasource-spring-cloud-config</module>
<module>sentinel-datasource-consul</module>
<module>sentinel-datasource-etcd</module>
<module>sentinel-logging-extension-slf4j</module>
</modules>

</project>

+ 18
- 0
sentinel-logging/pom.xml 查看文件

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-parent</artifactId>
<version>1.7.2-SNAPSHOT</version>
</parent>
<artifactId>sentinel-logging</artifactId>
<packaging>pom</packaging>

<modules>
<module>sentinel-logging-slf4j</module>
</modules>

</project>

sentinel-extension/sentinel-logging-extension-slf4j/README.md → sentinel-logging/sentinel-logging-slf4j/README.md 查看文件

@@ -1,22 +1,19 @@
# Sentinel Logging Extension SLF4J

To use Sentinel Logging Extension SLF4J with Log4j2, you should add the following dependency firstly:
To integrate logs of sentinel into your project which uses slf4j for bridge of logging you can
simply introduce following dependency to your project:

```xml
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-logging-extension-slf4j</artifactId>
<version>x.y.z</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
<artifactId>sentinel-logging-slf4j</artifactId>
<version>${sentinel.version}</version>
</dependency>
```
If you want to use Slf4j with Log4j2, you can add dependencies of Log4j2 and the binding about Log4j2 and SLF4J.
Then you should provide logging configuration as specification of the logging framework.
And you can add Sentinel's Loggers that it name is `sentinelRecordLogger` or `sentinelCommandCenterLogger` for your needs. For example:

And if you want to control level of logging special for sentinel the loggers that sentinel uses
are called `sentinelRecordLogger` and `sentinelCommandCenterLogger`. For example in XML configration
coming with log4j2 implementation:

```xml
<?xml version="1.0" encoding="UTF-8" ?>
@@ -45,5 +42,3 @@ And you can add Sentinel's Loggers that it name is `sentinelRecordLogger` or `se
</Loggers>
</Configuration>
```



sentinel-extension/sentinel-logging-extension-slf4j/pom.xml → sentinel-logging/sentinel-logging-slf4j/pom.xml 查看文件

@@ -3,13 +3,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sentinel-parent</artifactId>
<artifactId>sentinel-logging</artifactId>
<groupId>com.alibaba.csp</groupId>
<version>1.7.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>sentinel-logging-extension-slf4j</artifactId>
<artifactId>sentinel-logging-slf4j</artifactId>
<packaging>jar</packaging>

<properties>
@@ -57,4 +57,4 @@
</dependency>

</dependencies>
</project>
</project>

sentinel-extension/sentinel-logging-extension-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogLogger.java → sentinel-logging/sentinel-logging-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogLogger.java 查看文件


sentinel-extension/sentinel-logging-extension-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogLogger.java → sentinel-logging/sentinel-logging-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogLogger.java 查看文件


sentinel-extension/sentinel-logging-extension-slf4j/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.log.Logger → sentinel-logging/sentinel-logging-slf4j/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.log.Logger 查看文件


sentinel-extension/sentinel-logging-extension-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogTest.java → sentinel-logging/sentinel-logging-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogTest.java 查看文件


sentinel-extension/sentinel-logging-extension-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogTest.java → sentinel-logging/sentinel-logging-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogTest.java 查看文件


sentinel-extension/sentinel-logging-extension-slf4j/src/test/resources/log4j2.xml → sentinel-logging/sentinel-logging-slf4j/src/test/resources/log4j2.xml 查看文件


Loading…
取消
儲存