From df683b8716121d9bfaf2180c37783c475775b9f9 Mon Sep 17 00:00:00 2001 From: Jason Joo Date: Mon, 23 Mar 2020 18:02:15 +0800 Subject: [PATCH] Regroup packages related to logging into a separate module and polish document (#1355) --- pom.xml | 1 + sentinel-extension/pom.xml | 1 - sentinel-logging/pom.xml | 18 ++++++++++++++++ .../sentinel-logging-slf4j}/README.md | 21 +++++++------------ .../sentinel-logging-slf4j}/pom.xml | 6 +++--- .../logging/slf4j/CommandCenterLogLogger.java | 0 .../logging/slf4j/RecordLogLogger.java | 0 .../com.alibaba.csp.sentinel.log.Logger | 0 .../logging/slf4j/CommandCenterLogTest.java | 0 .../sentinel/logging/slf4j/RecordLogTest.java | 0 .../src/test/resources/log4j2.xml | 0 11 files changed, 30 insertions(+), 17 deletions(-) create mode 100755 sentinel-logging/pom.xml rename {sentinel-extension/sentinel-logging-extension-slf4j => sentinel-logging/sentinel-logging-slf4j}/README.md (61%) rename {sentinel-extension/sentinel-logging-extension-slf4j => sentinel-logging/sentinel-logging-slf4j}/pom.xml (94%) rename {sentinel-extension/sentinel-logging-extension-slf4j => sentinel-logging/sentinel-logging-slf4j}/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogLogger.java (100%) rename {sentinel-extension/sentinel-logging-extension-slf4j => sentinel-logging/sentinel-logging-slf4j}/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogLogger.java (100%) rename {sentinel-extension/sentinel-logging-extension-slf4j => sentinel-logging/sentinel-logging-slf4j}/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.log.Logger (100%) rename {sentinel-extension/sentinel-logging-extension-slf4j => sentinel-logging/sentinel-logging-slf4j}/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogTest.java (100%) rename {sentinel-extension/sentinel-logging-extension-slf4j => sentinel-logging/sentinel-logging-slf4j}/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogTest.java (100%) rename {sentinel-extension/sentinel-logging-extension-slf4j => sentinel-logging/sentinel-logging-slf4j}/src/test/resources/log4j2.xml (100%) diff --git a/pom.xml b/pom.xml index 2d80de93..646b4fa3 100755 --- a/pom.xml +++ b/pom.xml @@ -76,6 +76,7 @@ sentinel-demo sentinel-benchmark sentinel-cluster + sentinel-logging diff --git a/sentinel-extension/pom.xml b/sentinel-extension/pom.xml index 6d96dcce..72bd6d92 100755 --- a/sentinel-extension/pom.xml +++ b/sentinel-extension/pom.xml @@ -22,7 +22,6 @@ sentinel-datasource-spring-cloud-config sentinel-datasource-consul sentinel-datasource-etcd - sentinel-logging-extension-slf4j diff --git a/sentinel-logging/pom.xml b/sentinel-logging/pom.xml new file mode 100755 index 00000000..c058c667 --- /dev/null +++ b/sentinel-logging/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + + + com.alibaba.csp + sentinel-parent + 1.7.2-SNAPSHOT + + sentinel-logging + pom + + + sentinel-logging-slf4j + + + diff --git a/sentinel-extension/sentinel-logging-extension-slf4j/README.md b/sentinel-logging/sentinel-logging-slf4j/README.md similarity index 61% rename from sentinel-extension/sentinel-logging-extension-slf4j/README.md rename to sentinel-logging/sentinel-logging-slf4j/README.md index 6abf29b1..ca629721 100644 --- a/sentinel-extension/sentinel-logging-extension-slf4j/README.md +++ b/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 com.alibaba.csp - sentinel-logging-extension-slf4j - x.y.z - - - org.slf4j - slf4j-api - ${slf4j.version} + sentinel-logging-slf4j + ${sentinel.version} ``` -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 @@ -45,5 +42,3 @@ And you can add Sentinel's Loggers that it name is `sentinelRecordLogger` or `se ``` - - diff --git a/sentinel-extension/sentinel-logging-extension-slf4j/pom.xml b/sentinel-logging/sentinel-logging-slf4j/pom.xml similarity index 94% rename from sentinel-extension/sentinel-logging-extension-slf4j/pom.xml rename to sentinel-logging/sentinel-logging-slf4j/pom.xml index 351904bd..645900a3 100644 --- a/sentinel-extension/sentinel-logging-extension-slf4j/pom.xml +++ b/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"> - sentinel-parent + sentinel-logging com.alibaba.csp 1.7.2-SNAPSHOT 4.0.0 - sentinel-logging-extension-slf4j + sentinel-logging-slf4j jar @@ -57,4 +57,4 @@ - \ No newline at end of file + diff --git a/sentinel-extension/sentinel-logging-extension-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogLogger.java b/sentinel-logging/sentinel-logging-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogLogger.java similarity index 100% rename from sentinel-extension/sentinel-logging-extension-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogLogger.java rename to sentinel-logging/sentinel-logging-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogLogger.java diff --git a/sentinel-extension/sentinel-logging-extension-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogLogger.java b/sentinel-logging/sentinel-logging-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogLogger.java similarity index 100% rename from sentinel-extension/sentinel-logging-extension-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogLogger.java rename to sentinel-logging/sentinel-logging-slf4j/src/main/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogLogger.java diff --git a/sentinel-extension/sentinel-logging-extension-slf4j/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.log.Logger b/sentinel-logging/sentinel-logging-slf4j/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.log.Logger similarity index 100% rename from sentinel-extension/sentinel-logging-extension-slf4j/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.log.Logger rename to sentinel-logging/sentinel-logging-slf4j/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.log.Logger diff --git a/sentinel-extension/sentinel-logging-extension-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogTest.java b/sentinel-logging/sentinel-logging-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogTest.java similarity index 100% rename from sentinel-extension/sentinel-logging-extension-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogTest.java rename to sentinel-logging/sentinel-logging-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/CommandCenterLogTest.java diff --git a/sentinel-extension/sentinel-logging-extension-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogTest.java b/sentinel-logging/sentinel-logging-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogTest.java similarity index 100% rename from sentinel-extension/sentinel-logging-extension-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogTest.java rename to sentinel-logging/sentinel-logging-slf4j/src/test/java/com/alibaba/csp/sentinel/logging/slf4j/RecordLogTest.java diff --git a/sentinel-extension/sentinel-logging-extension-slf4j/src/test/resources/log4j2.xml b/sentinel-logging/sentinel-logging-slf4j/src/test/resources/log4j2.xml similarity index 100% rename from sentinel-extension/sentinel-logging-extension-slf4j/src/test/resources/log4j2.xml rename to sentinel-logging/sentinel-logging-slf4j/src/test/resources/log4j2.xml