update: 网关改成log4j2

This commit is contained in:
Wendal Chen 2020-04-21 15:02:25 +08:00
parent c16bce2161
commit 85273a58c3
4 changed files with 44 additions and 8 deletions

View File

@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<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>
<groupId>org.nutz.cloud</groupId>
@ -18,19 +19,31 @@
<groupId>org.nutz.cloud</groupId>
<artifactId>nutzcloud-loach-client</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-nacos-discovery</artifactId>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -119,6 +119,8 @@ public abstract class AbstractUrlRewriteRouterFilter implements RouteFilter {
ctx.targetHost = info.host;
if (info.port > 0)
ctx.targetPort = info.port;
if (log.isDebugEnabled())
log.debugf("forward reqest %s to %s:%s", ctx.uri, ctx.targetHost, ctx.targetPort);
return true;
}

View File

@ -1,6 +1,7 @@
log4j.rootLogger=debug,Console
log4j.logger.org.eclipse.jetty=info
log4j.loagger.com.alibaba.nacos.client=info
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout
pattern="[%-5p] %d{HH:mm:ss.SSS} %l - %m%n" />
</Console>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="Console" />
</Root>
<Logger name="org.eclipse.jetty" level="info" additivity="false">
<AppenderRef ref="Console" />
</Logger>
<Logger name="org.nutz.cloud.perca" level="debug" additivity="false">
<AppenderRef ref="Console" />
</Logger>
</Loggers>
</Configuration>