@@ -76,6 +76,7 @@ | |||||
<module>sentinel-demo</module> | <module>sentinel-demo</module> | ||||
<module>sentinel-benchmark</module> | <module>sentinel-benchmark</module> | ||||
<module>sentinel-cluster</module> | <module>sentinel-cluster</module> | ||||
<module>sentinel-logging</module> | |||||
</modules> | </modules> | ||||
<dependencyManagement> | <dependencyManagement> | ||||
@@ -22,7 +22,6 @@ | |||||
<module>sentinel-datasource-spring-cloud-config</module> | <module>sentinel-datasource-spring-cloud-config</module> | ||||
<module>sentinel-datasource-consul</module> | <module>sentinel-datasource-consul</module> | ||||
<module>sentinel-datasource-etcd</module> | <module>sentinel-datasource-etcd</module> | ||||
<module>sentinel-logging-extension-slf4j</module> | |||||
</modules> | </modules> | ||||
</project> | </project> |
@@ -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> |
@@ -1,22 +1,19 @@ | |||||
# Sentinel Logging Extension SLF4J | # 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 | ```xml | ||||
<dependency> | <dependency> | ||||
<groupId>com.alibaba.csp</groupId> | <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> | </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 | ||||
<?xml version="1.0" encoding="UTF-8" ?> | <?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> | </Loggers> | ||||
</Configuration> | </Configuration> | ||||
``` | ``` | ||||
@@ -3,13 +3,13 @@ | |||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 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"> | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||
<parent> | <parent> | ||||
<artifactId>sentinel-parent</artifactId> | |||||
<artifactId>sentinel-logging</artifactId> | |||||
<groupId>com.alibaba.csp</groupId> | <groupId>com.alibaba.csp</groupId> | ||||
<version>1.7.2-SNAPSHOT</version> | <version>1.7.2-SNAPSHOT</version> | ||||
</parent> | </parent> | ||||
<modelVersion>4.0.0</modelVersion> | <modelVersion>4.0.0</modelVersion> | ||||
<artifactId>sentinel-logging-extension-slf4j</artifactId> | |||||
<artifactId>sentinel-logging-slf4j</artifactId> | |||||
<packaging>jar</packaging> | <packaging>jar</packaging> | ||||
<properties> | <properties> | ||||
@@ -57,4 +57,4 @@ | |||||
</dependency> | </dependency> | ||||
</dependencies> | </dependencies> | ||||
</project> | |||||
</project> |