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

This commit is contained in:
Jason Joo 2020-03-23 18:02:15 +08:00 committed by GitHub
parent 1eee2c80b4
commit df683b8716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 30 additions and 17 deletions

View File

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

View File

@ -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
sentinel-logging/pom.xml Executable file
View File

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

View File

@ -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>
```

View File

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