seninel部署
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
tao.zhang 1eee2c80b4
Introduce logging extension: slf4j (#1344)
pirms 5 gadiem
..
src Introduce logging extension: slf4j (#1344) pirms 5 gadiem
README.md Introduce logging extension: slf4j (#1344) pirms 5 gadiem
pom.xml Introduce logging extension: slf4j (#1344) pirms 5 gadiem

README.md

Sentinel Logging Extension SLF4J

To use Sentinel Logging Extension SLF4J with Log4j2, you should add the following dependency firstly:

<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>
</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:

<?xml version="1.0" encoding="UTF-8" ?>
<Configuration>
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%-5level %logger - %msg%n"/>
        </Console>
        <File name="FILE" fileName="sentinel-record.log" append="false">
            <PatternLayout pattern="%-5level %logger - %msg%n"/>
        </File>
        <File name="FILE2" fileName="sentinel-command-center.log" append="false">
            <PatternLayout pattern="%-5level %logger - %msg%n"/>
        </File>
    </Appenders>
    <Loggers>
        <Root level="info"/>
        <logger name="sentinelRecordLogger" level="trace">
            <appender-ref ref="Console" />
            <appender-ref ref="FILE" />
        </logger>
        <logger name="sentinelCommandCenterLogger" level="trace">
            <appender-ref ref="Console" />
            <appender-ref ref="FILE2" />
        </logger>
    </Loggers>
</Configuration>