Skip to content

Commit

Permalink
Regroup packages related to logging into a separate module and polish…
Browse files Browse the repository at this point in the history
… document (#1355)
  • Loading branch information
jasonjoo2010 authored Mar 23, 2020
1 parent 1eee2c8 commit df683b8
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 17 deletions.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<module>sentinel-demo</module>
<module>sentinel-benchmark</module>
<module>sentinel-cluster</module>
<module>sentinel-logging</module>
</modules>

<dependencyManagement>
Expand Down
1 change: 0 additions & 1 deletion sentinel-extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 18 additions & 0 deletions sentinel-logging/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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" ?>
Expand Down Expand Up @@ -45,5 +42,3 @@ And you can add Sentinel's Loggers that it name is `sentinelRecordLogger` or `se
</Loggers>
</Configuration>
```


Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -57,4 +57,4 @@
</dependency>

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

0 comments on commit df683b8

Please sign in to comment.