Bladeren bron

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

master
Jason Joo GitHub 4 jaren geleden
bovenliggende
commit
df683b8716
Geen bekende sleutel gevonden voor deze handtekening in de database GPG sleutel-ID: 4AEE18F83AFDEB23
11 gewijzigde bestanden met toevoegingen van 30 en 17 verwijderingen
  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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven


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 Bestand weergeven


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 Bestand weergeven


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 Bestand weergeven


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 Bestand weergeven


sentinel-extension/sentinel-logging-extension-slf4j/src/test/resources/log4j2.xml → sentinel-logging/sentinel-logging-slf4j/src/test/resources/log4j2.xml Bestand weergeven


Laden…
Annuleren
Opslaan