You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2020/03/20 07:55:56 UTC

[servicecomb-java-chassis] 01/04: [SCB-1796] support client outlog

This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit f156eb21b4f2e782523064d49b63eda7cce7ca40
Author: heyile <25...@qq.com>
AuthorDate: Wed Mar 11 16:17:47 2020 +0800

    [SCB-1796] support client outlog
---
 .../rest/codec/param/RestClientRequestImpl.java    |  16 +
 .../core/event/ServerAccessLogEvent.java           |  73 +++++
 dependencies/default/pom.xml                       |   5 +
 foundations/foundation-log/pom.xml                 |  25 ++
 .../foundation/log/LogBootListener.java            |  19 ++
 .../servicecomb/foundation/log/LogBootstrap.java   |  22 ++
 .../servicecomb/foundation/log/LogConfig.java      |  61 ++++
 .../servicecomb/foundation/log/LogInitializer.java |  18 +-
 .../log/client/ClientDefaultInitializer.java       |  33 +++
 .../foundation/log/core/LogGenerator.java          |  70 +++++
 .../servicecomb/foundation/log/core}/README.md     |   0
 .../foundation/log/core/element/LogItem.java       |  13 +-
 .../log/core/element/impl/CookieItem.java          |  78 +++++
 .../element/impl/DatetimeConfigurableItem.java     |  24 +-
 .../core/element/impl/DurationMillisecondItem.java |  30 +-
 .../log/core/element/impl/DurationSecondItem.java  |  24 +-
 .../core/element/impl/FirstLineOfRequestItem.java  |  54 ++++
 .../log/core/element/impl/HttpMethodItem.java      |  65 +++++
 .../log/core}/element/impl/HttpStatusItem.java     |  32 +-
 .../core}/element/impl/InvocationContextItem.java  |  40 +--
 .../log/core}/element/impl/LocalHostItem.java      |  39 ++-
 .../log/core/element/impl/LocalPortItem.java       |  32 +-
 .../log/core}/element/impl/PlainTextItem.java      |  19 +-
 .../log/core/element/impl/QueryStringItem.java     |  53 ++++
 .../log/core/element/impl/RemoteHostItem.java      |  53 ++++
 .../log/core/element/impl/RequestHeaderItem.java   |  66 +++++
 .../core}/element/impl/RequestProtocolItem.java    |  35 ++-
 .../log/core/element/impl/ResponseHeaderItem.java  |  62 ++++
 .../log/core}/element/impl/ResponseSizeItem.java   |  29 +-
 .../log/core}/element/impl/TraceIdItem.java        |  23 +-
 .../log/core/element/impl/UrlPathItem.java         |  64 ++++
 .../core/element/impl/UrlPathWithQueryItem.java    |  53 ++++
 .../core/parser/CompositeVertxRestLogItemMeta.java |   8 +-
 .../foundation/log/core/parser/LogItemCreator.java |  17 +-
 .../foundation/log/core/parser/LogItemMeta.java    |  27 +-
 .../log/core/parser/LogPatternParser.java          |  15 +-
 .../log/core/parser/VertxRestLogItemMeta.java      |  22 +-
 .../impl/DefaultCompositeVertxRestLogItemMeta.java |  87 ++++++
 .../parser/impl/VertxRestLogPatternParser.java     |  70 ++---
 .../log/core/placeholder/LogItemTypeEnum.java      |   4 +-
 .../log/server/ServerDefaultInitializer.java       |  34 +++
 .../org.apache.servicecomb.core.BootListener       |  18 ++
 ...pache.servicecomb.foundation.log.LogInitializer |  19 ++
 ...foundation.log.core.parser.VertxRestLogItemMeta |  18 ++
 .../transport-rest/transport-rest-vertx/pom.xml    |   5 +-
 .../transport/rest/vertx/RestServerVerticle.java   |  25 +-
 .../vertx/accesslog/AccessLogConfiguration.java    |  53 ----
 .../rest/vertx/accesslog/AccessLogGenerator.java   |  64 ----
 .../rest/vertx/accesslog/AccessLogParam.java       |  88 ------
 .../vertx/accesslog/element/impl/CookieItem.java   |  62 ----
 .../element/impl/DurationMillisecondItem.java      |  30 --
 .../accesslog/element/impl/DurationSecondItem.java |  30 --
 .../element/impl/FirstLineOfRequestItem.java       |  45 ---
 .../accesslog/element/impl/HttpMethodItem.java     |  47 ---
 .../accesslog/element/impl/LocalPortItem.java      |  45 ---
 .../accesslog/element/impl/RemoteHostItem.java     |  50 ----
 .../accesslog/element/impl/RequestHeaderItem.java  |  55 ----
 .../accesslog/element/impl/ResponseHeaderItem.java |  60 ----
 .../element/impl/UrlPathWithQueryItem.java         |  45 ---
 .../vertx/accesslog/impl/AccessLogHandler.java     |  53 ----
 ...DefaultCompositeVertxRestAccessLogItemMeta.java |  87 ------
 .../accesslog/AccessLogConfigurationTest.java      |  38 ---
 .../vertx/accesslog/AccessLogGeneratorTest.java    |  69 -----
 .../accesslog/element/impl/CookieItemTest.java     | 101 -------
 .../element/impl/DatetimeConfigurableItemTest.java | 135 ---------
 .../element/impl/DurationMillisecondItemTest.java  |  40 ---
 .../element/impl/DurationSecondItemTest.java       |  60 ----
 .../element/impl/FirstLineOfRequestItemTest.java   |  52 ----
 .../accesslog/element/impl/HttpMethodItemTest.java |  66 -----
 .../accesslog/element/impl/HttpStatusItemTest.java |  70 -----
 .../element/impl/InvocationContextItemTest.java    | 100 -------
 .../accesslog/element/impl/LocalHostItemTest.java  | 124 --------
 .../accesslog/element/impl/LocalPortItemTest.java  |  76 -----
 .../element/impl/QueryStringItemTest.java          |  90 ------
 .../accesslog/element/impl/RemoteHostItemTest.java | 117 --------
 .../element/impl/RequestHeaderItemTest.java        |  87 ------
 .../element/impl/RequestProtocolItemTest.java      |  82 ------
 .../element/impl/ResponseHeaderItemTest.java       | 103 -------
 .../element/impl/ResponseSizeItemTest.java         |  78 -----
 .../accesslog/element/impl/TraceIdItemTest.java    | 137 ---------
 .../accesslog/element/impl/UrlPathItemTest.java    |  73 -----
 .../element/impl/UrlPathWithQueryItemTest.java     |  94 ------
 .../impl/UserDefinedAccessLogItemLowPriority.java  |  35 ---
 .../vertx/accesslog/impl/AccessLogHandlerTest.java | 111 -------
 .../TestCompositeExtendedAccessLogItemMeta.java    |  38 ---
 .../impl/TestSingleExtendedAccessLogItemMeta.java  |  27 --
 .../impl/VertxRestAccessLogPatternParserTest.java  | 322 ---------------------
 87 files changed, 1354 insertions(+), 3384 deletions(-)

diff --git a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/RestClientRequestImpl.java b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/RestClientRequestImpl.java
index d5a43c3..76ded99 100644
--- a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/RestClientRequestImpl.java
+++ b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/RestClientRequestImpl.java
@@ -277,6 +277,22 @@ public class RestClientRequestImpl implements RestClientRequest {
     request.putHeader(HttpHeaders.COOKIE, builder.toString());
   }
 
+  public Context getContext() {
+    return context;
+  }
+
+  public HttpClientRequest getRequest() {
+    return request;
+  }
+
+  public Map<String, String> getCookieMap() {
+    return cookieMap;
+  }
+
+  public Map<String, Object> getFormMap() {
+    return formMap;
+  }
+
   @Override
   public void addCookie(String name, String value) {
     if (cookieMap == null) {
diff --git a/core/src/main/java/org/apache/servicecomb/core/event/ServerAccessLogEvent.java b/core/src/main/java/org/apache/servicecomb/core/event/ServerAccessLogEvent.java
new file mode 100644
index 0000000..63e14bf
--- /dev/null
+++ b/core/src/main/java/org/apache/servicecomb/core/event/ServerAccessLogEvent.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.core.event;
+
+import io.vertx.ext.web.RoutingContext;
+
+public class ServerAccessLogEvent {
+  private long milliStartTime;
+
+  private long milliEndTime;
+
+  private RoutingContext routingContext;
+
+  /**
+   * If client send request via a short-lived connection, the connection may be closed before the corresponding
+   * access log is generated, and then we can not get valid host ip
+   * may get "0.0.0.0" as result. So we need to get local address before the connection is closed.
+   */
+  private String localAddress;
+
+  public ServerAccessLogEvent() {
+  }
+
+  public long getMilliStartTime() {
+    return milliStartTime;
+  }
+
+  public ServerAccessLogEvent setMilliStartTime(long milliStartTime) {
+    this.milliStartTime = milliStartTime;
+    return this;
+  }
+
+  public long getMilliEndTime() {
+    return milliEndTime;
+  }
+
+  public ServerAccessLogEvent setMilliEndTime(long milliEndTime) {
+    this.milliEndTime = milliEndTime;
+    return this;
+  }
+
+  public RoutingContext getRoutingContext() {
+    return routingContext;
+  }
+
+  public ServerAccessLogEvent setRoutingContext(RoutingContext routingContext) {
+    this.routingContext = routingContext;
+    return this;
+  }
+
+  public String getLocalAddress() {
+    return localAddress;
+  }
+
+  public ServerAccessLogEvent setLocalAddress(String localAddress) {
+    this.localAddress = localAddress;
+    return this;
+  }
+}
diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml
index a5cb146..28a9180 100644
--- a/dependencies/default/pom.xml
+++ b/dependencies/default/pom.xml
@@ -1122,6 +1122,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.servicecomb</groupId>
+        <artifactId>foundation-log</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
         <artifactId>foundation-vertx</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git a/foundations/foundation-log/pom.xml b/foundations/foundation-log/pom.xml
new file mode 100644
index 0000000..83cbe24
--- /dev/null
+++ b/foundations/foundation-log/pom.xml
@@ -0,0 +1,25 @@
+<?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">
+  <parent>
+    <artifactId>foundations</artifactId>
+    <groupId>org.apache.servicecomb</groupId>
+    <version>2.0.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>foundation-log</artifactId>
+  <name>Java Chassis::Foundations::Log</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>java-chassis-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>common-rest</artifactId>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/LogBootListener.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/LogBootListener.java
new file mode 100644
index 0000000..250aa5f
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/LogBootListener.java
@@ -0,0 +1,19 @@
+package org.apache.servicecomb.foundation.log;
+
+import org.apache.servicecomb.core.BootListener;
+import org.apache.servicecomb.foundation.common.event.EventManager;
+
+public class LogBootListener implements BootListener {
+
+  private LogBootstrap logBootstrap = new LogBootstrap();
+
+  @Override
+  public void onAfterRegistry(BootEvent event) {
+    logBootstrap.start(EventManager.getEventBus());
+  }
+
+  @Override
+  public void onBeforeClose(BootEvent event) {
+    logBootstrap.shutdown();
+  }
+}
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/LogBootstrap.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/LogBootstrap.java
new file mode 100644
index 0000000..286289f
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/LogBootstrap.java
@@ -0,0 +1,22 @@
+package org.apache.servicecomb.foundation.log;
+
+import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
+
+import com.google.common.eventbus.EventBus;
+
+public class LogBootstrap {
+  private static LogConfig config = LogConfig.INSTANCE;
+
+  private EventBus eventBus;
+
+  public void start(EventBus eventBus) {
+    this.eventBus = eventBus;
+    SPIServiceUtils.getSortedService(LogInitializer.class)
+        .forEach(initializer -> initializer.init(eventBus, config));
+  }
+
+  public void shutdown() {
+    SPIServiceUtils.getSortedService(LogInitializer.class)
+        .forEach(LogInitializer::destroy);
+  }
+}
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/LogConfig.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/LogConfig.java
new file mode 100644
index 0000000..4496aeb
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/LogConfig.java
@@ -0,0 +1,61 @@
+package org.apache.servicecomb.foundation.log;
+
+import com.netflix.config.DynamicPropertyFactory;
+
+public class LogConfig {
+
+    private static final String SERVER_BASE = "servicecomb.accesslog.";
+
+    private static final String CLIENT_BASE = "servicecomb.outlog.";
+
+    private static final String SERVER_LOG_ENABLED = SERVER_BASE + "enabled";
+
+    private static final String SERVER_LOG_PATTERN = SERVER_BASE + "pattern";
+
+    private static final String CLIENT_LOG_ENABLED = CLIENT_BASE + "enabled";
+
+    private static final String CLIENT_LOG_PATTERN = CLIENT_BASE + "pattern";
+
+    public static final String DEFAULT_PATTERN = "%h - - %t %r %s %B %D";
+
+    public static final LogConfig INSTANCE = new LogConfig();
+
+    private boolean serverLogEnabled;
+
+    private boolean clientLogEnabled;
+
+    private String serverLogPattern;
+
+    private String clientLogPattern;
+
+    private LogConfig() {
+        init();
+    }
+
+    private void init() {
+        clientLogEnabled = DynamicPropertyFactory
+            .getInstance().getBooleanProperty(CLIENT_LOG_ENABLED, false).get();
+        serverLogEnabled = DynamicPropertyFactory
+            .getInstance().getBooleanProperty(SERVER_LOG_ENABLED, false).get();
+        clientLogPattern = DynamicPropertyFactory
+          .getInstance().getStringProperty(CLIENT_LOG_PATTERN, DEFAULT_PATTERN).get();
+        serverLogPattern = DynamicPropertyFactory
+            .getInstance().getStringProperty(SERVER_LOG_PATTERN, DEFAULT_PATTERN).get();
+    }
+
+    public boolean isServerLogEnabled() {
+        return serverLogEnabled;
+    }
+
+    public boolean isClientLogEnabled() {
+        return clientLogEnabled;
+    }
+
+    public String getServerLogPattern() {
+        return serverLogPattern;
+    }
+
+    public String getClientLogPattern() {
+        return clientLogPattern;
+    }
+}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/PlainTextItemTest.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/LogInitializer.java
similarity index 69%
rename from transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/PlainTextItemTest.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/LogInitializer.java
index e4f812f..02f8520 100644
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/PlainTextItemTest.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/LogInitializer.java
@@ -14,18 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.servicecomb.foundation.log;
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
+import com.google.common.eventbus.EventBus;
 
-import static org.junit.Assert.assertEquals;
+public interface LogInitializer {
+    default int getOrder() {
+        return 0;
+    }
 
-import org.junit.Test;
+    void init(EventBus eventBus, LogConfig logConfig);
 
-public class PlainTextItemTest {
-
-  @Test
-  public void getFormattedElement() {
-    PlainTextItem element = new PlainTextItem("contentTest");
-    assertEquals("contentTest", element.getFormattedItem(null));
-  }
+    default void destroy() {}
 }
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/client/ClientDefaultInitializer.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/client/ClientDefaultInitializer.java
new file mode 100644
index 0000000..7ba14d2
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/client/ClientDefaultInitializer.java
@@ -0,0 +1,33 @@
+package org.apache.servicecomb.foundation.log.client;
+
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.foundation.log.LogConfig;
+import org.apache.servicecomb.foundation.log.LogInitializer;
+import org.apache.servicecomb.foundation.log.core.LogGenerator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.eventbus.AllowConcurrentEvents;
+import com.google.common.eventbus.EventBus;
+import com.google.common.eventbus.Subscribe;
+
+public class ClientDefaultInitializer implements LogInitializer {
+  private static Logger LOGGER = LoggerFactory.getLogger("outlog");
+
+  private LogGenerator logGenerator;
+
+  @Override
+  public void init(EventBus eventBus, LogConfig logConfig) {
+    if (!logConfig.isClientLogEnabled()) {
+      return;
+    }
+    logGenerator = new LogGenerator(logConfig.getClientLogPattern());
+    eventBus.register(this);
+  }
+
+  @Subscribe
+  @AllowConcurrentEvents
+  public void onRequestOut(InvocationFinishEvent finishEvent) {
+    LOGGER.info(logGenerator.generateClientLog(finishEvent));
+  }
+}
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/LogGenerator.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/LogGenerator.java
new file mode 100644
index 0000000..6933841
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/LogGenerator.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.log.core;
+
+import java.util.List;
+
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+import org.apache.servicecomb.foundation.log.core.parser.LogPatternParser;
+import org.apache.servicecomb.foundation.log.core.parser.impl.VertxRestLogPatternParser;
+
+import com.google.common.collect.Iterables;
+
+import io.vertx.ext.web.RoutingContext;
+
+/*
+ * Accept {@link AccessLogParam} and generate access log.
+ * <br/>
+ * Each AccessLogParam for a line of access log.
+ */
+public class LogGenerator {
+  /*
+   * traversal this array to generate access log segment.
+   */
+  private LogItem<RoutingContext>[] logItems;
+
+  private LogPatternParser<RoutingContext> logPatternParser = new VertxRestLogPatternParser();
+
+  @SuppressWarnings("unchecked")
+  public LogGenerator(String rawPattern) {
+    List<LogItem<RoutingContext>> logItemList = logPatternParser.parsePattern(rawPattern);
+    logItems = Iterables.toArray(logItemList, LogItem.class);
+  }
+
+  public String generateServerLog(ServerAccessLogEvent accessLogEvent) {
+    StringBuilder log = new StringBuilder(128);
+    for (LogItem<RoutingContext> logItem : getLogItems()) {
+      logItem.appendFormattedItem(accessLogEvent, log);
+    }
+    return log.toString();
+  }
+
+  public String generateClientLog(InvocationFinishEvent finishEvent) {
+    StringBuilder log = new StringBuilder(128);
+    for (LogItem<RoutingContext> logItem : getLogItems()) {
+      logItem.appendFormattedItem(finishEvent, log);
+    }
+    return log.toString();
+  }
+
+  private LogItem<RoutingContext>[] getLogItems() {
+    return logItems;
+  }
+}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/README.md b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/README.md
similarity index 100%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/README.md
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/README.md
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/AccessLogItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/LogItem.java
similarity index 71%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/AccessLogItem.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/LogItem.java
index 078066f..d52cd97 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/AccessLogItem.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/LogItem.java
@@ -15,17 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element;
+package org.apache.servicecomb.foundation.log.core.element;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
 
 /*
  * Access log item represents the items supported in access log printing.
  * It generate the segment of access log according to {@link AccessLogParam}
  */
-public interface AccessLogItem<T> {
+public interface LogItem<T> {
   /*
    * find out specified content from {@link AccessLogParam}, format the content and return it.
    */
-  String getFormattedItem(AccessLogParam<T> accessLogParam);
+  default void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+  }
+
+  default void appendFormattedItem(InvocationFinishEvent clientLogEvent, StringBuilder builder) {
+  }
 }
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/CookieItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/CookieItem.java
new file mode 100644
index 0000000..e454d8f
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/CookieItem.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.log.core.element.impl;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.servicecomb.common.rest.RestConst;
+import org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+
+import io.vertx.core.http.Cookie;
+import io.vertx.ext.web.RoutingContext;
+
+public class CookieItem implements LogItem<RoutingContext> {
+
+  public static final String RESULT_NOT_FOUND = "-";
+
+  private final String varName;
+
+  public CookieItem(String varName) {
+    this.varName = varName;
+  }
+
+  @Override
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    Map<String, Cookie> cookieMap = accessLogEvent.getRoutingContext().cookieMap();
+    if (null == cookieMap) {
+      builder.append(RESULT_NOT_FOUND);
+      return;
+    }
+    for (Cookie cookie : cookieMap.values()) {
+      if (varName.equals(cookie.getName())) {
+        builder.append(cookie.getValue());
+        return;
+      }
+    }
+    builder.append(RESULT_NOT_FOUND);
+  }
+
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    RestClientRequestImpl restRequestImpl = (RestClientRequestImpl) finishEvent.getInvocation().getHandlerContext()
+      .get(RestConst.INVOCATION_HANDLER_REQUESTCLIENT);
+    if (null == restRequestImpl || null == restRequestImpl.getCookieMap()) {
+      builder.append(RESULT_NOT_FOUND);
+      return;
+    }
+    for (Entry<String, String> entry : restRequestImpl.getCookieMap().entrySet()) {
+      if (entry.getKey().equals(varName)) {
+        builder.append(entry.getValue());
+        return;
+      }
+    }
+    builder.append(RESULT_NOT_FOUND);
+  }
+
+  public String getVarName() {
+    return varName;
+  }
+}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/DatetimeConfigurableItem.java
similarity index 76%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItem.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/DatetimeConfigurableItem.java
index 740c474..98657bf 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItem.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/DatetimeConfigurableItem.java
@@ -15,15 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
+package org.apache.servicecomb.foundation.log.core.element.impl;
 
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Locale;
 import java.util.TimeZone;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
 import org.springframework.util.StringUtils;
 
 import io.vertx.ext.web.RoutingContext;
@@ -31,7 +32,7 @@ import io.vertx.ext.web.RoutingContext;
 /**
  * Configurable dateTime element.
  */
-public class DatetimeConfigurableItem implements AccessLogItem<RoutingContext> {
+public class DatetimeConfigurableItem implements LogItem<RoutingContext> {
 
   public static final String DEFAULT_DATETIME_PATTERN = "EEE, dd MMM yyyy HH:mm:ss zzz";
 
@@ -67,7 +68,7 @@ public class DatetimeConfigurableItem implements AccessLogItem<RoutingContext> {
     }
     if (3 != configArr.length) {
       throw new IllegalArgumentException(
-          "wrong format of configuration, \"PATTERN|TIMEZONE|LOCALE\" is expected, but actually is \"" + config + "\"");
+        "wrong format of configuration, \"PATTERN|TIMEZONE|LOCALE\" is expected, but actually is \"" + config + "\"");
     }
 
     setConfigruations(configArr);
@@ -84,9 +85,18 @@ public class DatetimeConfigurableItem implements AccessLogItem<RoutingContext> {
   }
 
   @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    doAppendFormattedItem(accessLogEvent.getMilliStartTime(), builder);
+  }
+
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    doAppendFormattedItem(finishEvent.getInvocation().getInvocationStageTrace().getStart() / 1000_000, builder);
+  }
+
+  private void doAppendFormattedItem(long milliStartTime, StringBuilder builder) {
     SimpleDateFormat dateFormat = getDatetimeFormat();
-    return dateFormat.format(new Date(accessLogParam.getStartMillisecond()));
+    builder.append(dateFormat.format(new Date(milliStartTime)));
   }
 
   private SimpleDateFormat getDatetimeFormat() {
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/QueryStringItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/DurationMillisecondItem.java
similarity index 50%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/QueryStringItem.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/DurationMillisecondItem.java
index 6439b99..10b7b71 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/QueryStringItem.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/DurationMillisecondItem.java
@@ -15,30 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
+package org.apache.servicecomb.foundation.log.core.element.impl;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-import org.springframework.util.StringUtils;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
 
-import io.vertx.core.http.HttpServerRequest;
 import io.vertx.ext.web.RoutingContext;
 
-public class QueryStringItem implements AccessLogItem<RoutingContext> {
+public class DurationMillisecondItem implements LogItem<RoutingContext> {
 
-  public static final String EMPTY_RESULT = "-";
-
-  @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    HttpServerRequest request = accessLogParam.getContextData().request();
-    if (null == request) {
-      return EMPTY_RESULT;
+    @Override
+    public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+        builder.append(accessLogEvent.getMilliEndTime() - accessLogEvent.getMilliStartTime());
     }
 
-    String query = request.query();
-    if (StringUtils.isEmpty(query)) {
-      return EMPTY_RESULT;
+    @Override
+    public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+        builder.append((finishEvent.getInvocation().getInvocationStageTrace().getFinish() -
+          finishEvent.getInvocation().getInvocationStageTrace().getStart()) / 1000_000);
     }
-    return query;
-  }
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UserDefinedAccessLogItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/DurationSecondItem.java
similarity index 51%
rename from transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UserDefinedAccessLogItem.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/DurationSecondItem.java
index a2559c6..8517685 100644
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UserDefinedAccessLogItem.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/DurationSecondItem.java
@@ -15,25 +15,25 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
+package org.apache.servicecomb.foundation.log.core.element.impl;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
+
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
 
 import io.vertx.ext.web.RoutingContext;
 
-/**
- * For access log extension test
- */
-public class UserDefinedAccessLogItem implements AccessLogItem<RoutingContext> {
-  private String config;
+public class DurationSecondItem implements LogItem<RoutingContext> {
 
-  public UserDefinedAccessLogItem(String config) {
-    this.config = config;
+  @Override
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    builder.append((accessLogEvent.getMilliEndTime() - accessLogEvent.getMilliStartTime()) / 1000);
   }
 
   @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    return "user-defined-" + config;
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    builder.append((finishEvent.getInvocation().getInvocationStageTrace().getFinish() -
+      finishEvent.getInvocation().getInvocationStageTrace().getStart()) / 1000_000_000);
   }
 }
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/FirstLineOfRequestItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/FirstLineOfRequestItem.java
new file mode 100644
index 0000000..0f504ad
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/FirstLineOfRequestItem.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.log.core.element.impl;
+
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+
+import io.vertx.ext.web.RoutingContext;
+
+public class FirstLineOfRequestItem implements LogItem<RoutingContext> {
+  private static final HttpMethodItem METHOD_ELEMENT = new HttpMethodItem();
+
+  private static final UrlPathItem URI_PATH_ONLY_ELEMENT = new UrlPathItem();
+
+  private static final RequestProtocolItem VERSION_OR_PROTOCOL_ELEMENT = new RequestProtocolItem();
+
+  @Override
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    builder.append("\"");
+    METHOD_ELEMENT.appendFormattedItem(accessLogEvent, builder);
+    builder.append(" ");
+    URI_PATH_ONLY_ELEMENT.appendFormattedItem(accessLogEvent, builder);
+    builder.append(" ");
+    VERSION_OR_PROTOCOL_ELEMENT.appendFormattedItem(accessLogEvent, builder);
+    builder.append("\"");
+  }
+
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    builder.append("\"");
+    METHOD_ELEMENT.appendFormattedItem(finishEvent, builder);
+    builder.append(" ");
+    URI_PATH_ONLY_ELEMENT.appendFormattedItem(finishEvent, builder);
+    builder.append(" ");
+    VERSION_OR_PROTOCOL_ELEMENT.appendFormattedItem(finishEvent, builder);
+    builder.append("\"");
+  }
+}
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/HttpMethodItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/HttpMethodItem.java
new file mode 100644
index 0000000..5303b7a
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/HttpMethodItem.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.log.core.element.impl;
+
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.servicecomb.common.rest.RestConst;
+import org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl;
+import org.apache.servicecomb.core.definition.OperationMeta;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+
+import io.vertx.core.http.HttpServerRequest;
+import io.vertx.ext.web.RoutingContext;
+
+/**
+ * HTTP method
+ */
+public class HttpMethodItem implements LogItem<RoutingContext> {
+
+  public static final String EMPTY_RESULT = "-";
+
+  @Override
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    HttpServerRequest request = accessLogEvent.getRoutingContext().request();
+    if (null == request || null == request.method()) {
+      builder.append(EMPTY_RESULT);
+      return;
+    }
+    builder.append(request.method().toString());
+  }
+
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    OperationMeta operationMeta = finishEvent.getInvocation().getOperationMeta();
+    if (!StringUtils.isEmpty(operationMeta.getHttpMethod())) {
+      builder.append(operationMeta.getHttpMethod());
+      return;
+    }
+    RestClientRequestImpl restRequestImpl = (RestClientRequestImpl) finishEvent.getInvocation().getHandlerContext()
+      .get(RestConst.INVOCATION_HANDLER_REQUESTCLIENT);
+    if (null == restRequestImpl || null == restRequestImpl.getRequest()
+      || null == restRequestImpl.getRequest().method()) {
+      builder.append(EMPTY_RESULT);
+      return;
+    }
+    builder.append(restRequestImpl.getRequest().method().toString());
+  }
+}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/HttpStatusItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/HttpStatusItem.java
similarity index 57%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/HttpStatusItem.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/HttpStatusItem.java
index 69b10a4..4d7cf70 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/HttpStatusItem.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/HttpStatusItem.java
@@ -15,33 +15,47 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
+package org.apache.servicecomb.foundation.log.core.element.impl;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+import org.apache.servicecomb.swagger.invocation.Response;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import io.vertx.core.http.HttpServerResponse;
 import io.vertx.ext.web.RoutingContext;
 
-public class HttpStatusItem implements AccessLogItem<RoutingContext> {
+public class HttpStatusItem implements LogItem<RoutingContext> {
   private static Logger LOGGER = LoggerFactory.getLogger(HttpStatusItem.class);
 
   public static final String EMPTY_RESULT = "-";
 
   @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    HttpServerResponse response = accessLogParam.getContextData().response();
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    HttpServerResponse response = accessLogEvent.getRoutingContext().response();
     if (null == response) {
-      return EMPTY_RESULT;
+      builder.append(EMPTY_RESULT);
+      return;
     }
     if (response.closed() && !response.ended()) {
       LOGGER.warn(
           "Response is closed before sending any data. "
               + "Please check idle connection timeout for provider is properly configured.");
-      return EMPTY_RESULT;
+      builder.append(EMPTY_RESULT);
+      return;
     }
-    return String.valueOf(response.getStatusCode());
+    builder.append(response.getStatusCode());
+  }
+
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    Response response = finishEvent.getResponse();
+    if (null == response) {
+      builder.append(EMPTY_RESULT);
+      return;
+    }
+    builder.append(response.getStatusCode());
   }
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/InvocationContextItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/InvocationContextItem.java
similarity index 54%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/InvocationContextItem.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/InvocationContextItem.java
index f479d1b..76c8150 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/InvocationContextItem.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/InvocationContextItem.java
@@ -15,19 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
+package org.apache.servicecomb.foundation.log.core.element.impl;
 
 import java.util.Map;
 
 import org.apache.servicecomb.common.rest.RestConst;
 import org.apache.servicecomb.core.Invocation;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
 import org.springframework.util.StringUtils;
 
 import io.vertx.ext.web.RoutingContext;
 
-public class InvocationContextItem implements AccessLogItem<RoutingContext> {
+public class InvocationContextItem implements LogItem<RoutingContext> {
 
   public static final String NOT_FOUND = "-";
 
@@ -38,28 +39,31 @@ public class InvocationContextItem implements AccessLogItem<RoutingContext> {
   }
 
   @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    String invocationContextValue = getValueFromInvocationContext(accessLogParam);
-
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    String invocationContextValue = getValueFromInvocationContext(accessLogEvent);
     if (StringUtils.isEmpty(invocationContextValue)) {
-      return NOT_FOUND;
+      builder.append(NOT_FOUND);
+      return;
     }
-
-    return invocationContextValue;
+    builder.append(invocationContextValue);
   }
 
-  protected String getValueFromInvocationContext(AccessLogParam<RoutingContext> accessLogParam) {
-    Map<String, Object> data = accessLogParam.getContextData().data();
-    if (null == data) {
-      return null;
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    if (StringUtils.isEmpty(finishEvent.getInvocation().getContext().get(varName))) {
+      builder.append(NOT_FOUND);
+      return;
     }
+    builder.append(finishEvent.getInvocation().getContext().get(varName));
+  }
+
 
-    Invocation invocation = (Invocation) data.get(RestConst.REST_INVOCATION_CONTEXT);
-    if (null == invocation) {
+  protected String getValueFromInvocationContext(ServerAccessLogEvent accessLogEvent) {
+    Map<String, Object> data = accessLogEvent.getRoutingContext().data();
+    if (null == data || null == data.get(RestConst.REST_INVOCATION_CONTEXT)) {
       return null;
     }
-
-    return invocation.getContext(varName);
+    return ((Invocation) data.get(RestConst.REST_INVOCATION_CONTEXT)).getContext(varName);
   }
 
   public String getVarName() {
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/LocalHostItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/LocalHostItem.java
similarity index 52%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/LocalHostItem.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/LocalHostItem.java
index cbb1e87..b62f07d 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/LocalHostItem.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/LocalHostItem.java
@@ -15,40 +15,39 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
+package org.apache.servicecomb.foundation.log.core.element.impl;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
+
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
 import org.springframework.util.StringUtils;
 
 import io.vertx.core.http.HttpServerRequest;
-import io.vertx.core.net.SocketAddress;
 import io.vertx.ext.web.RoutingContext;
 
-public class LocalHostItem implements AccessLogItem<RoutingContext> {
+public class LocalHostItem implements LogItem<RoutingContext> {
 
   public static final String EMPTY_RESULT = "-";
 
   @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    return accessLogParam.getLocalAddress();
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    builder.append(accessLogEvent.getLocalAddress());
   }
 
-  public static String getLocalAddress(AccessLogParam<RoutingContext> accessLogParam) {
-    HttpServerRequest request = accessLogParam.getContextData().request();
-    if (null == request) {
-      return EMPTY_RESULT;
-    }
-
-    SocketAddress localAddress = request.localAddress();
-    if (null == localAddress) {
-      return EMPTY_RESULT;
-    }
+  /**
+   * client do not need localhost
+   */
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    builder.append(EMPTY_RESULT);
+  }
 
-    String localHost = localAddress.host();
-    if (StringUtils.isEmpty(localHost)) {
+  public static String getLocalAddress(RoutingContext context) {
+    HttpServerRequest request = context.request();
+    if (null == request || null == request.localAddress() || StringUtils.isEmpty(request.localAddress().host())) {
       return EMPTY_RESULT;
     }
-    return localHost;
+    return request.localAddress().host();
   }
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UrlPathItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/LocalPortItem.java
similarity index 53%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UrlPathItem.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/LocalPortItem.java
index 309ecc0..e78c192 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UrlPathItem.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/LocalPortItem.java
@@ -15,31 +15,33 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
+package org.apache.servicecomb.foundation.log.core.element.impl;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
+
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
 
 import io.vertx.core.http.HttpServerRequest;
 import io.vertx.ext.web.RoutingContext;
 
-public class UrlPathItem implements AccessLogItem<RoutingContext> {
+public class LocalPortItem implements LogItem<RoutingContext> {
 
   public static final String EMPTY_RESULT = "-";
 
   @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    HttpServerRequest request = accessLogParam.getContextData().request();
-
-    if (null == request) {
-      return EMPTY_RESULT;
-    }
-
-    String uri = request.path();
-    if (null == uri) {
-      return EMPTY_RESULT;
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    HttpServerRequest request = accessLogEvent.getRoutingContext().request();
+    if (null == request || null == request.localAddress()) {
+      builder.append(EMPTY_RESULT);
+      return;
     }
+    builder.append(request.localAddress().port());
+  }
 
-    return uri;
+  // client do not need local port
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    builder.append(EMPTY_RESULT);
   }
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/PlainTextItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/PlainTextItem.java
similarity index 63%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/PlainTextItem.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/PlainTextItem.java
index fb7683f..88d99a8 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/PlainTextItem.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/PlainTextItem.java
@@ -15,17 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
+package org.apache.servicecomb.foundation.log.core.element.impl;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
+
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
 
 import io.vertx.ext.web.RoutingContext;
 
 /**
  * Print content as it is.
  */
-public class PlainTextItem implements AccessLogItem<RoutingContext> {
+public class PlainTextItem implements LogItem<RoutingContext> {
   private final String content;
 
   public PlainTextItem(String content) {
@@ -33,7 +35,12 @@ public class PlainTextItem implements AccessLogItem<RoutingContext> {
   }
 
   @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    return content;
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    builder.append(content);
+  }
+
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    builder.append(content);
   }
 }
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/QueryStringItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/QueryStringItem.java
new file mode 100644
index 0000000..157bd39
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/QueryStringItem.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.log.core.element.impl;
+
+import org.apache.servicecomb.common.rest.RestConst;
+import org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+
+import io.vertx.core.http.HttpServerRequest;
+import io.vertx.ext.web.RoutingContext;
+
+public class QueryStringItem implements LogItem<RoutingContext> {
+
+  public static final String EMPTY_RESULT = "-";
+
+  @Override
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    HttpServerRequest request = accessLogEvent.getRoutingContext().request();
+    if (null == request || null == request.query()) {
+      builder.append(EMPTY_RESULT);
+      return;
+    }
+    builder.append(request.query());
+  }
+
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    RestClientRequestImpl restRequestImpl = (RestClientRequestImpl) finishEvent.getInvocation().getHandlerContext()
+      .get(RestConst.INVOCATION_HANDLER_REQUESTCLIENT);
+    if (null == restRequestImpl || null == restRequestImpl.getRequest()) {
+      builder.append(EMPTY_RESULT);
+      return;
+    }
+    builder.append(restRequestImpl.getRequest().query());
+  }
+}
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/RemoteHostItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/RemoteHostItem.java
new file mode 100644
index 0000000..0334009
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/RemoteHostItem.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.log.core.element.impl;
+
+
+import org.apache.servicecomb.core.Endpoint;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.common.net.URIEndpointObject;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+
+import io.vertx.core.http.HttpServerRequest;
+import io.vertx.ext.web.RoutingContext;
+
+public class RemoteHostItem implements LogItem<RoutingContext> {
+
+  public static final String EMPTY_RESULT = "-";
+
+  @Override
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    HttpServerRequest request = accessLogEvent.getRoutingContext().request();
+    if (null == request || null == request.remoteAddress()) {
+      builder.append(EMPTY_RESULT);
+      return;
+    }
+    builder.append(request.remoteAddress().host());
+  }
+
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent clientLogEvent, StringBuilder builder) {
+    Endpoint endpoint = clientLogEvent.getInvocation().getEndpoint();
+    if (null == endpoint || null == endpoint.getAddress()) {
+      builder.append(EMPTY_RESULT);
+      return;
+    }
+    builder.append(((URIEndpointObject) endpoint.getAddress()).getHostOrIp());
+  }
+}
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/RequestHeaderItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/RequestHeaderItem.java
new file mode 100644
index 0000000..3ceb1ab
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/RequestHeaderItem.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.log.core.element.impl;
+
+import org.apache.servicecomb.common.rest.RestConst;
+import org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+import org.springframework.util.StringUtils;
+
+import io.vertx.core.MultiMap;
+import io.vertx.ext.web.RoutingContext;
+
+public class RequestHeaderItem implements LogItem<RoutingContext> {
+
+  public static final String RESULT_NOT_FOUND = "-";
+
+  private final String varName;
+
+  public RequestHeaderItem(String varName) {
+    this.varName = varName;
+  }
+
+  @Override
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    MultiMap headers = accessLogEvent.getRoutingContext().request().headers();
+    if (null == headers || StringUtils.isEmpty(headers.get(varName))) {
+      builder.append(RESULT_NOT_FOUND);
+      return;
+    }
+    builder.append(headers.get(varName));
+  }
+
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent clientLogEvent, StringBuilder builder) {
+    RestClientRequestImpl restRequestImpl = (RestClientRequestImpl) clientLogEvent.getInvocation().getHandlerContext()
+      .get(RestConst.INVOCATION_HANDLER_REQUESTCLIENT);
+    if (null == restRequestImpl || null == restRequestImpl.getRequest()
+      || null == restRequestImpl.getRequest().headers()
+      || StringUtils.isEmpty(restRequestImpl.getRequest().headers().get(varName))) {
+      builder.append(RESULT_NOT_FOUND);
+      return;
+    }
+    builder.append(restRequestImpl.getRequest().headers().get(varName));
+  }
+
+  public String getVarName() {
+    return varName;
+  }
+}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RequestProtocolItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/RequestProtocolItem.java
similarity index 53%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RequestProtocolItem.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/RequestProtocolItem.java
index b2a9948..8c9a339 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RequestProtocolItem.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/RequestProtocolItem.java
@@ -15,29 +15,40 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
+package org.apache.servicecomb.foundation.log.core.element.impl;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
+
+import org.apache.servicecomb.core.Endpoint;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.common.net.URIEndpointObject;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
 
 import io.vertx.core.http.HttpServerRequest;
 import io.vertx.core.http.HttpVersion;
 import io.vertx.ext.web.RoutingContext;
 
-public class RequestProtocolItem implements AccessLogItem<RoutingContext> {
+public class RequestProtocolItem implements LogItem<RoutingContext> {
 
   public static final String EMPTY_RESULT = "-";
 
   @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    HttpServerRequest request = accessLogParam.getContextData().request();
-    if (null == request) {
-      return EMPTY_RESULT;
-    }
-    if (null == request.version()) {
-      return EMPTY_RESULT;
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    HttpServerRequest request = accessLogEvent.getRoutingContext().request();
+    if (null == request || null == request.version()) {
+      builder.append(EMPTY_RESULT);
+      return;
     }
-    return getStringVersion(request.version());
+    builder.append(getStringVersion(request.version()));
+  }
+
+  /**
+   * 先这样实现, 后面讨论
+   */
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    Endpoint endpoint = finishEvent.getInvocation().getEndpoint();
+    builder.append(((URIEndpointObject) endpoint.getAddress()).isSslEnabled() ? "https" : "http");
   }
 
   private String getStringVersion(HttpVersion version) {
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/ResponseHeaderItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/ResponseHeaderItem.java
new file mode 100644
index 0000000..8febdfa
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/ResponseHeaderItem.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.log.core.element.impl;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+import org.apache.servicecomb.swagger.invocation.Response;
+
+import io.vertx.core.http.HttpServerResponse;
+import io.vertx.ext.web.RoutingContext;
+
+public class ResponseHeaderItem implements LogItem<RoutingContext> {
+
+  public static final String RESULT_NOT_FOUND = "-";
+
+  private final String varName;
+
+  public ResponseHeaderItem(String varName) {
+    this.varName = varName;
+  }
+
+  @Override
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    HttpServerResponse response = accessLogEvent.getRoutingContext().response();
+    if (null == response || null == response.headers() || StringUtils.isEmpty(response.headers().get(varName))) {
+      builder.append(RESULT_NOT_FOUND);
+      return;
+    }
+    builder.append(response.headers().get(varName));
+  }
+
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    Response response = finishEvent.getResponse();
+    if (null == response || null == response.getHeaders() || null == response.getHeaders().getFirst(varName)) {
+      builder.append(RESULT_NOT_FOUND);
+      return;
+    }
+    builder.append(response.getHeaders().getFirst(varName));
+  }
+
+  public String getVarName() {
+    return varName;
+  }
+}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/ResponseSizeItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/ResponseSizeItem.java
similarity index 54%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/ResponseSizeItem.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/ResponseSizeItem.java
index cb43bd5..a982990 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/ResponseSizeItem.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/ResponseSizeItem.java
@@ -15,15 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
+package org.apache.servicecomb.foundation.log.core.element.impl;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
 
 import io.vertx.core.http.HttpServerResponse;
 import io.vertx.ext.web.RoutingContext;
 
-public class ResponseSizeItem implements AccessLogItem<RoutingContext> {
+public class ResponseSizeItem implements LogItem<RoutingContext> {
   // print zeroBytes when bytes is zero
   private final String zeroBytes;
 
@@ -32,14 +33,22 @@ public class ResponseSizeItem implements AccessLogItem<RoutingContext> {
   }
 
   @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    HttpServerResponse response = accessLogParam.getContextData().response();
-    if (null == response) {
-      return zeroBytes;
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    HttpServerResponse response = accessLogEvent.getRoutingContext().response();
+    if (null == response || 0 == response.bytesWritten()) {
+      builder.append(zeroBytes);
+      return;
     }
+    builder.append(response.bytesWritten());
+  }
 
-    long bytesWritten = response.bytesWritten();
-    return 0 == bytesWritten ? zeroBytes : String.valueOf(bytesWritten);
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    if (null == finishEvent.getResponse().getResult()) {
+      builder.append(zeroBytes);
+      return;
+    }
+    builder.append(finishEvent.getResponse().getResult().toString().length());
   }
 
   public String getZeroBytes() {
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/TraceIdItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/TraceIdItem.java
similarity index 58%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/TraceIdItem.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/TraceIdItem.java
index 5499033..5c35e92 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/TraceIdItem.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/TraceIdItem.java
@@ -15,14 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
+package org.apache.servicecomb.foundation.log.core.element.impl;
 
 import org.apache.servicecomb.core.Const;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
 import org.springframework.util.StringUtils;
 
-import io.vertx.ext.web.RoutingContext;
-
 public class TraceIdItem extends InvocationContextItem {
 
   public static final String TRACE_ID = Const.TRACE_ID_NAME;
@@ -32,16 +31,18 @@ public class TraceIdItem extends InvocationContextItem {
   }
 
   @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    String traceId = getValueFromInvocationContext(accessLogParam);
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    String traceId = getValueFromInvocationContext(accessLogEvent);
     if (StringUtils.isEmpty(traceId)) {
-      traceId = accessLogParam.getContextData().request().getHeader(TRACE_ID);
+      traceId = accessLogEvent.getRoutingContext().request().getHeader(TRACE_ID);
     }
 
-    if (StringUtils.isEmpty(traceId)) {
-      return InvocationContextItem.NOT_FOUND;
-    }
+    builder.append(StringUtils.isEmpty(traceId) ? InvocationContextItem.NOT_FOUND : traceId);
+  }
 
-    return traceId;
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    String traceId = finishEvent.getInvocation().getContext().get(TRACE_ID);
+    builder.append(StringUtils.isEmpty(traceId) ? InvocationContextItem.NOT_FOUND : traceId);
   }
 }
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/UrlPathItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/UrlPathItem.java
new file mode 100644
index 0000000..a44d72d
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/UrlPathItem.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.log.core.element.impl;
+
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.servicecomb.common.rest.RestConst;
+import org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl;
+import org.apache.servicecomb.core.definition.OperationMeta;
+import org.apache.servicecomb.core.definition.SchemaMeta;
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+
+import io.vertx.core.http.HttpServerRequest;
+import io.vertx.ext.web.RoutingContext;
+
+public class UrlPathItem implements LogItem<RoutingContext> {
+
+  public static final String EMPTY_RESULT = "-";
+
+  @Override
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    HttpServerRequest request = accessLogEvent.getRoutingContext().request();
+    if (null == request || StringUtils.isEmpty(request.path())) {
+      builder.append(EMPTY_RESULT);
+      return;
+    }
+    builder.append(request.path());
+  }
+
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    OperationMeta operationMeta = finishEvent.getInvocation().getOperationMeta();
+    SchemaMeta schemaMeta = finishEvent.getInvocation().getSchemaMeta();
+    if (operationMeta != null && schemaMeta != null) {
+      builder.append(schemaMeta.getSwagger().getBasePath()).append(operationMeta.getOperationPath());
+      return;
+    }
+    RestClientRequestImpl restRequestImpl = (RestClientRequestImpl) finishEvent.getInvocation().getHandlerContext()
+        .get(RestConst.INVOCATION_HANDLER_REQUESTCLIENT);
+    if (null == restRequestImpl || null == restRequestImpl.getRequest()
+        || StringUtils.isEmpty(restRequestImpl.getRequest().path())) {
+      builder.append(EMPTY_RESULT);
+      return;
+    }
+    builder.append(restRequestImpl.getRequest().path());
+  }
+}
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/UrlPathWithQueryItem.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/UrlPathWithQueryItem.java
new file mode 100644
index 0000000..febc7f6
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/element/impl/UrlPathWithQueryItem.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.log.core.element.impl;
+
+import static org.apache.servicecomb.common.rest.RestConst.REST_CLIENT_REQUEST_PATH;
+
+import org.apache.servicecomb.core.event.InvocationFinishEvent;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+import org.springframework.util.StringUtils;
+
+import io.vertx.core.http.HttpServerRequest;
+import io.vertx.ext.web.RoutingContext;
+
+public class UrlPathWithQueryItem implements LogItem<RoutingContext> {
+
+  public static final String EMPTY_RESULT = "-";
+
+  @Override
+  public void appendFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
+    HttpServerRequest request = accessLogEvent.getRoutingContext().request();
+    if (null == request || StringUtils.isEmpty(request.uri())) {
+      builder.append(EMPTY_RESULT);
+      return;
+    }
+    builder.append(request.uri());
+  }
+
+  @Override
+  public void appendFormattedItem(InvocationFinishEvent finishEvent, StringBuilder builder) {
+    Object path = finishEvent.getInvocation().getLocalContext(REST_CLIENT_REQUEST_PATH);
+    if (null == path || StringUtils.isEmpty(path.toString())) {
+      builder.append(EMPTY_RESULT);
+      return;
+    }
+    builder.append(path.toString());
+  }
+}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/CompositeVertxRestAccessLogItemMeta.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/CompositeVertxRestLogItemMeta.java
similarity index 77%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/CompositeVertxRestAccessLogItemMeta.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/CompositeVertxRestLogItemMeta.java
index e5a5b82..3cb707d 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/CompositeVertxRestAccessLogItemMeta.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/CompositeVertxRestLogItemMeta.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.parser;
+package org.apache.servicecomb.foundation.log.core.parser;
 
 import java.util.List;
 
 /**
- * Hold a group of {@link VertxRestAccessLogItemMeta} so that user can define
+ * Hold a group of {@link VertxRestLogItemMeta} so that user can define
  * only one VertxRestAccessLogItemMeta in spi loading file and load a group of meta.
  * 
  * Once the access log loading mechanism finds that a meta is CompositeVertxRestAccessLogItemMeta,
  * the meta hold by it will be used in access log while this meta itself will be ignored.
  */
-public abstract class CompositeVertxRestAccessLogItemMeta extends VertxRestAccessLogItemMeta {
-  public abstract List<VertxRestAccessLogItemMeta> getAccessLogItemMetas();
+public abstract class CompositeVertxRestLogItemMeta extends VertxRestLogItemMeta {
+  public abstract List<VertxRestLogItemMeta> getAccessLogItemMetas();
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/AccessLogItemCreator.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/LogItemCreator.java
similarity index 61%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/AccessLogItemCreator.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/LogItemCreator.java
index ebd522b..7a6f279 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/AccessLogItemCreator.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/LogItemCreator.java
@@ -15,20 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.parser;
+package org.apache.servicecomb.foundation.log.core.parser;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.CookieItem;
 
 /**
- * The {@linkplain AccessLogItemCreator}s are able to instantiate a group of {@linkplain AccessLogItem}.
+ * The {@linkplain LogItemCreator}s are able to instantiate a group of {@linkplain LogItem}.
  */
-public interface AccessLogItemCreator<T> {
+public interface LogItemCreator<T> {
   /**
-   * Create an instance of {@linkplain AccessLogItem} which is specified by the config.
+   * Create an instance of {@linkplain LogItem} which is specified by the config.
    * @param config
-   * e.g. For {@linkplain org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.CookieItem CookieItem},
-   * the pattern may be "%{varName}C", and it's config is "varName". Some {@linkplain AccessLogItem} with no configurable
+   * e.g. For {@linkplain CookieItem CookieItem},
+   * the pattern may be "%{varName}C", and it's config is "varName". Some {@linkplain LogItem} with no configurable
    * pattern (like "%m") will receive {@code null} as config.
    */
-  AccessLogItem<T> createItem(String config);
+  LogItem<T> createItem(String config);
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/AccessLogItemMeta.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/LogItemMeta.java
similarity index 61%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/AccessLogItemMeta.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/LogItemMeta.java
index b47e5d1..c2d6adc 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/AccessLogItemMeta.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/LogItemMeta.java
@@ -15,31 +15,27 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.parser;
+package org.apache.servicecomb.foundation.log.core.parser;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
 
-/**
- * The meta data of {@linkplain AccessLogItem}.
- */
-public class AccessLogItemMeta<T> {
+public class LogItemMeta<T> {
   protected String prefix;
 
   protected String suffix;
 
   /**
-   * Used for sorting {@linkplain AccessLogItemMeta}. Default value is 0.
+   * Used for sorting {@linkplain LogItemMeta}. Default value is 0.
    * Smaller one has higher priority.
    */
   protected int order;
 
-  protected AccessLogItemCreator<T> accessLogItemCreator;
+  protected LogItemCreator<T> logItemCreator;
 
   public String getPrefix() {
     return prefix;
   }
 
-  public AccessLogItemMeta<T> setPrefix(String prefix) {
+  public LogItemMeta<T> setPrefix(String prefix) {
     this.prefix = prefix;
     return this;
   }
@@ -48,7 +44,7 @@ public class AccessLogItemMeta<T> {
     return suffix;
   }
 
-  public AccessLogItemMeta<T> setSuffix(String suffix) {
+  public LogItemMeta<T> setSuffix(String suffix) {
     this.suffix = suffix;
     return this;
   }
@@ -57,18 +53,17 @@ public class AccessLogItemMeta<T> {
     return order;
   }
 
-  public AccessLogItemMeta<T> setOrder(int order) {
+  public LogItemMeta<T> setOrder(int order) {
     this.order = order;
     return this;
   }
 
-  public AccessLogItemCreator<T> getAccessLogItemCreator() {
-    return accessLogItemCreator;
+  public LogItemCreator<T> getLogItemCreator() {
+    return logItemCreator;
   }
 
-  public AccessLogItemMeta<T> setAccessLogItemCreator(
-      AccessLogItemCreator<T> accessLogItemCreator) {
-    this.accessLogItemCreator = accessLogItemCreator;
+  public LogItemMeta<T> setLogItemCreator(LogItemCreator<T> logItemCreator) {
+    this.logItemCreator = logItemCreator;
     return this;
   }
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/AccessLogPatternParser.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/LogPatternParser.java
similarity index 65%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/AccessLogPatternParser.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/LogPatternParser.java
index bc38768..3adb8b2 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/AccessLogPatternParser.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/LogPatternParser.java
@@ -15,19 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.parser;
+package org.apache.servicecomb.foundation.log.core.parser;
 
 import java.util.List;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
+import org.apache.servicecomb.foundation.log.core.LogGenerator;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
 
 /**
- * This parser will parse the rawPattern of access log and generate a list of {@link AccessLogItem},
- * which will be used in {@link org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogGenerator} to generate
+ * This parser will parse the rawPattern of access log and generate a list of {@link LogItem},
+ * which will be used in {@link LogGenerator} to generate
  * access log content.
- * @param <T> the type of {@linkplain org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam#contextData
+ * @param <T> the type of {@linkplain LogItem
  * AccessLogParam.contextData}, which usually depends on the transport way.
  */
-public interface AccessLogPatternParser<T> {
-  List<AccessLogItem<T>> parsePattern(String rawPattern);
+public interface LogPatternParser<T> {
+  List<LogItem<T>> parsePattern(String rawPattern);
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/VertxRestAccessLogItemMeta.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/VertxRestLogItemMeta.java
similarity index 57%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/VertxRestAccessLogItemMeta.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/VertxRestLogItemMeta.java
index 7f7916f..588abe3 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/VertxRestAccessLogItemMeta.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/VertxRestLogItemMeta.java
@@ -15,31 +15,31 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.parser;
+package org.apache.servicecomb.foundation.log.core.parser;
 
 import io.vertx.ext.web.RoutingContext;
 
 /**
  * For vertx-rest transport way.
  */
-public class VertxRestAccessLogItemMeta extends AccessLogItemMeta<RoutingContext> {
-  public VertxRestAccessLogItemMeta() {
+public class VertxRestLogItemMeta extends LogItemMeta<RoutingContext> {
+  public VertxRestLogItemMeta() {
   }
 
-  public VertxRestAccessLogItemMeta(String prefix, String suffix,
-      AccessLogItemCreator<RoutingContext> accessLogItemCreator, int order) {
+  public VertxRestLogItemMeta(String prefix, String suffix,
+      LogItemCreator<RoutingContext> logItemCreator, int order) {
     this.prefix = prefix;
     this.suffix = suffix;
-    this.accessLogItemCreator = accessLogItemCreator;
+    this.logItemCreator = logItemCreator;
     this.order = order;
   }
 
-  public VertxRestAccessLogItemMeta(String prefix, AccessLogItemCreator<RoutingContext> accessLogItemCreator) {
-    this(prefix, null, accessLogItemCreator, 0);
+  public VertxRestLogItemMeta(String prefix, LogItemCreator<RoutingContext> logItemCreator) {
+    this(prefix, null, logItemCreator, 0);
   }
 
-  public VertxRestAccessLogItemMeta(String prefix, String suffix,
-      AccessLogItemCreator<RoutingContext> accessLogItemCreator) {
-    this(prefix, suffix, accessLogItemCreator, 0);
+  public VertxRestLogItemMeta(String prefix, String suffix,
+      LogItemCreator<RoutingContext> logItemCreator) {
+    this(prefix, suffix, logItemCreator, 0);
   }
 }
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/impl/DefaultCompositeVertxRestLogItemMeta.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/impl/DefaultCompositeVertxRestLogItemMeta.java
new file mode 100644
index 0000000..7b5cd4a
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/impl/DefaultCompositeVertxRestLogItemMeta.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.foundation.log.core.parser.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.CookieItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.DatetimeConfigurableItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.DurationMillisecondItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.DurationSecondItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.FirstLineOfRequestItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.HttpMethodItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.HttpStatusItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.InvocationContextItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.LocalHostItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.LocalPortItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.QueryStringItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.RemoteHostItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.RequestHeaderItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.RequestProtocolItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.ResponseHeaderItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.ResponseSizeItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.TraceIdItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.UrlPathItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.UrlPathWithQueryItem;
+import org.apache.servicecomb.foundation.log.core.parser.CompositeVertxRestLogItemMeta;
+import org.apache.servicecomb.foundation.log.core.parser.VertxRestLogItemMeta;
+
+import io.vertx.ext.web.RoutingContext;
+
+public class DefaultCompositeVertxRestLogItemMeta extends CompositeVertxRestLogItemMeta {
+  private static final List<VertxRestLogItemMeta> SUPPORTED_META = new ArrayList<>();
+
+  static {
+    final LogItem<RoutingContext> httpMethodItem = new HttpMethodItem();
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%m", config -> httpMethodItem));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("cs-method", config -> httpMethodItem));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%s", config -> new HttpStatusItem()));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("sc-status", config -> new HttpStatusItem()));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%T", config -> new DurationSecondItem()));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%D", config -> new DurationMillisecondItem()));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%h", config -> new RemoteHostItem()));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%v", config -> new LocalHostItem()));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%p", config -> new LocalPortItem()));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%B", config -> new ResponseSizeItem("0")));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%b", config -> new ResponseSizeItem("-")));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%r", config -> new FirstLineOfRequestItem()));
+    final LogItem<RoutingContext> urlPathItem = new UrlPathItem();
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%U", config -> urlPathItem));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("cs-uri-stem", config -> urlPathItem));
+    final LogItem<RoutingContext> queryStringItem = new QueryStringItem();
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%q", config -> queryStringItem));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("cs-uri-query", config -> queryStringItem));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("cs-uri", config -> new UrlPathWithQueryItem()));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%H", config -> new RequestProtocolItem()));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%t", config -> new DatetimeConfigurableItem()));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%SCB-traceId", config -> new TraceIdItem()));
+
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%{", "}t", DatetimeConfigurableItem::new));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%{", "}i", RequestHeaderItem::new));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%{", "}o", ResponseHeaderItem::new));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%{", "}C", CookieItem::new));
+    SUPPORTED_META.add(new VertxRestLogItemMeta("%{", "}SCB-ctx", InvocationContextItem::new));
+  }
+
+  @Override
+  public List<VertxRestLogItemMeta> getAccessLogItemMetas() {
+    return SUPPORTED_META;
+  }
+}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/VertxRestAccessLogPatternParser.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/impl/VertxRestLogPatternParser.java
similarity index 78%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/VertxRestAccessLogPatternParser.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/impl/VertxRestLogPatternParser.java
index 5151f5c..40e7438 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/VertxRestAccessLogPatternParser.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/parser/impl/VertxRestLogPatternParser.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.parser.impl;
+package org.apache.servicecomb.foundation.log.core.parser.impl;
 
 import java.util.ArrayList;
 import java.util.Comparator;
@@ -23,12 +23,12 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.PlainTextItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.AccessLogItemMeta;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.AccessLogPatternParser;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.CompositeVertxRestAccessLogItemMeta;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.VertxRestAccessLogItemMeta;
+import org.apache.servicecomb.foundation.log.core.element.LogItem;
+import org.apache.servicecomb.foundation.log.core.element.impl.PlainTextItem;
+import org.apache.servicecomb.foundation.log.core.parser.CompositeVertxRestLogItemMeta;
+import org.apache.servicecomb.foundation.log.core.parser.LogItemMeta;
+import org.apache.servicecomb.foundation.log.core.parser.LogPatternParser;
+import org.apache.servicecomb.foundation.log.core.parser.VertxRestLogItemMeta;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,10 +37,10 @@ import io.vertx.ext.web.RoutingContext;
 /**
  * The parser is used for rest-over-vertx transport.
  */
-public class VertxRestAccessLogPatternParser implements AccessLogPatternParser<RoutingContext> {
-  private static final Logger LOGGER = LoggerFactory.getLogger(VertxRestAccessLogPatternParser.class);
+public class VertxRestLogPatternParser implements LogPatternParser<RoutingContext> {
+  private static final Logger LOGGER = LoggerFactory.getLogger(VertxRestLogPatternParser.class);
 
-  public static final Comparator<VertxRestAccessLogItemMeta> accessLogItemMetaComparator = (m1, m2) -> {
+  public static final Comparator<VertxRestLogItemMeta> accessLogItemMetaComparator = (m1, m2) -> {
     int result = m1.getOrder() - m2.getOrder();
     if (result != 0) {
       return result;
@@ -60,17 +60,17 @@ public class VertxRestAccessLogPatternParser implements AccessLogPatternParser<R
         : result;
   };
 
-  private List<VertxRestAccessLogItemMeta> metaList = new ArrayList<>();
+  private List<VertxRestLogItemMeta> metaList = new ArrayList<>();
 
-  public VertxRestAccessLogPatternParser() {
-    List<VertxRestAccessLogItemMeta> loadedMeta = loadVertxRestAccessLogItemMeta();
+  public VertxRestLogPatternParser() {
+    List<VertxRestLogItemMeta> loadedMeta = loadVertxRestAccessLogItemMeta();
     if (null == loadedMeta || loadedMeta.isEmpty()) {
       LOGGER.error("cannot load AccessLogItemMeta!");
       throw new IllegalStateException("cannot load AccessLogItemMeta!");
     }
-    for (VertxRestAccessLogItemMeta meta : loadedMeta) {
-      if (CompositeVertxRestAccessLogItemMeta.class.isAssignableFrom(meta.getClass())) {
-        this.metaList.addAll(((CompositeVertxRestAccessLogItemMeta) meta).getAccessLogItemMetas());
+    for (VertxRestLogItemMeta meta : loadedMeta) {
+      if (CompositeVertxRestLogItemMeta.class.isAssignableFrom(meta.getClass())) {
+        this.metaList.addAll(((CompositeVertxRestLogItemMeta) meta).getAccessLogItemMetas());
       } else {
         this.metaList.add(meta);
       }
@@ -78,8 +78,8 @@ public class VertxRestAccessLogPatternParser implements AccessLogPatternParser<R
     sortAccessLogItemMeta(this.metaList);
   }
 
-  private List<VertxRestAccessLogItemMeta> loadVertxRestAccessLogItemMeta() {
-    return SPIServiceUtils.getOrLoadSortedService(VertxRestAccessLogItemMeta.class);
+  private List<VertxRestLogItemMeta> loadVertxRestAccessLogItemMeta() {
+    return SPIServiceUtils.getOrLoadSortedService(VertxRestLogItemMeta.class);
   }
 
   /**
@@ -104,17 +104,17 @@ public class VertxRestAccessLogPatternParser implements AccessLogPatternParser<R
   }
 
   /**
-   * Sort all of the {@link AccessLogItemMeta}, the meta that is in front of the others has higher priority.
+   * Sort all of the {@link LogItemMeta}, the meta that is in front of the others has higher priority.
    * 
    * Sort rule(priority decreased):
    * <ol>
-   *   <li>compare the {@link AccessLogItemMeta#order}</li>
-   *   <li>compare the {@link AccessLogItemMeta#suffix} in lexicographic order, if one's suffix is start with
+   *   <li>compare the {@link LogItemMeta#getOrder()}</li>
+   *   <li>compare the {@link LogItemMeta#getSuffix()} in lexicographic order, if one's suffix is start with
    *   the other one's suffix, this one(who's suffix is longer) has higher priority</li>
-   *   <li>compare the {@link AccessLogItemMeta#prefix}, compare rule is the same as suffix.</li>
+   *   <li>compare the {@link LogItemMeta#getPrefix()}, compare rule is the same as suffix.</li>
    * </ol>
    *
-   * e.g. given a list of {@link AccessLogItemMeta} like below:
+   * e.g. given a list of {@link LogItemMeta} like below:
    * <ol>
    * <li>(%ac{,}bcd)</li>
    * <li>(%ac{,}bc)</li>
@@ -137,16 +137,16 @@ public class VertxRestAccessLogPatternParser implements AccessLogPatternParser<R
    * <li>(%b,)</li>
    * </ol>
    */
-  public static void sortAccessLogItemMeta(List<VertxRestAccessLogItemMeta> accessLogItemMetaList) {
+  public static void sortAccessLogItemMeta(List<VertxRestLogItemMeta> accessLogItemMetaList) {
     accessLogItemMetaList.sort(accessLogItemMetaComparator);
   }
 
   /**
    * @param rawPattern The access log pattern string specified by users.
-   * @return A list of {@linkplain AccessLogItem} which actually generate the content of access log.
+   * @return A list of {@linkplain LogItem} which actually generate the content of access log.
    */
   @Override
-  public List<AccessLogItem<RoutingContext>> parsePattern(String rawPattern) {
+  public List<LogItem<RoutingContext>> parsePattern(String rawPattern) {
     LOGGER.info("parse the pattern of access log: [{}]", rawPattern);
     List<AccessLogItemLocation> locationList = matchAccessLogItem(rawPattern);
     locationList = fillInPlainTextLocation(rawPattern, locationList);
@@ -164,7 +164,7 @@ public class VertxRestAccessLogPatternParser implements AccessLogPatternParser<R
     int cursor = 0;
     while (cursor < rawPattern.length()) {
       AccessLogItemLocation candidate = null;
-      for (VertxRestAccessLogItemMeta meta : metaList) {
+      for (VertxRestLogItemMeta meta : metaList) {
         if (null != candidate && null == meta.getSuffix()) {
           // TODO:
           // if user define item("%{","}ab") and item("%{_","}abc") and the pattern is "%{_var}ab}abc"
@@ -209,7 +209,7 @@ public class VertxRestAccessLogPatternParser implements AccessLogPatternParser<R
   }
 
   /**
-   * After processing of {@link #matchAccessLogItem(String)}, all of the placeholders of {@link AccessLogItem} have been
+   * After processing of {@link #matchAccessLogItem(String)}, all of the placeholders of {@link LogItem} have been
    * picked out. So the rest part of rawPattern should be treated as plain text. Those parts will be located in this
    * method and wrapped as {@link PlainTextItem}.
    * @param rawPattern raw pattern string of access log
@@ -252,12 +252,12 @@ public class VertxRestAccessLogPatternParser implements AccessLogPatternParser<R
     return new AccessLogItemLocation(front, rear);
   }
 
-  private List<AccessLogItem<RoutingContext>> convertToItemList(String rawPattern,
+  private List<LogItem<RoutingContext>> convertToItemList(String rawPattern,
       List<AccessLogItemLocation> locationList) {
-    List<AccessLogItem<RoutingContext>> itemList = new ArrayList<>();
+    List<LogItem<RoutingContext>> itemList = new ArrayList<>();
 
     for (AccessLogItemLocation accessLogItemLocation : locationList) {
-      VertxRestAccessLogItemMeta accessLogItemMeta = accessLogItemLocation.accessLogItemMeta;
+      VertxRestLogItemMeta accessLogItemMeta = accessLogItemLocation.accessLogItemMeta;
       if (null == accessLogItemMeta) {
         // a PlainTextItem location
         itemList.add(new PlainTextItem(rawPattern.substring(
@@ -267,7 +267,7 @@ public class VertxRestAccessLogPatternParser implements AccessLogPatternParser<R
       }
 
       itemList.add(
-          accessLogItemMeta.getAccessLogItemCreator().createItem(
+          accessLogItemMeta.getLogItemCreator().createItem(
               getConfigString(rawPattern, accessLogItemLocation))
       );
     }
@@ -302,7 +302,7 @@ public class VertxRestAccessLogPatternParser implements AccessLogPatternParser<R
      */
     int tail;
 
-    VertxRestAccessLogItemMeta accessLogItemMeta;
+    VertxRestLogItemMeta accessLogItemMeta;
 
     /**
      * for {@link PlainTextItem} only
@@ -316,7 +316,7 @@ public class VertxRestAccessLogPatternParser implements AccessLogPatternParser<R
     /**
      * for configurable type AccessLogItem
      */
-    AccessLogItemLocation(int prefixIndex, int suffixIndex, VertxRestAccessLogItemMeta accessLogItemMeta) {
+    AccessLogItemLocation(int prefixIndex, int suffixIndex, VertxRestLogItemMeta accessLogItemMeta) {
       this.prefixIndex = prefixIndex;
       this.suffixIndex = suffixIndex;
       this.tail = suffixIndex + accessLogItemMeta.getSuffix().length();
@@ -326,7 +326,7 @@ public class VertxRestAccessLogPatternParser implements AccessLogPatternParser<R
     /**
      * for simple type AccessLogItem
      */
-    AccessLogItemLocation(int prefixIndex, VertxRestAccessLogItemMeta accessLogItemMeta) {
+    AccessLogItemLocation(int prefixIndex, VertxRestLogItemMeta accessLogItemMeta) {
       this.prefixIndex = prefixIndex;
       this.suffixIndex = prefixIndex + accessLogItemMeta.getPrefix().length();
       this.tail = this.suffixIndex;
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/placeholder/AccessLogItemTypeEnum.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/placeholder/LogItemTypeEnum.java
similarity index 93%
rename from transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/placeholder/AccessLogItemTypeEnum.java
rename to foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/placeholder/LogItemTypeEnum.java
index 010a080..a25762f 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/placeholder/AccessLogItemTypeEnum.java
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/core/placeholder/LogItemTypeEnum.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.transport.rest.vertx.accesslog.placeholder;
+package org.apache.servicecomb.foundation.log.core.placeholder;
 
 /**
  * record what kinds of access log item we support
  */
-public enum AccessLogItemTypeEnum {
+public enum LogItemTypeEnum {
   TEXT_PLAIN,
   // %m, cs-method
   HTTP_METHOD,
diff --git a/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/server/ServerDefaultInitializer.java b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/server/ServerDefaultInitializer.java
new file mode 100644
index 0000000..e9ca5ea
--- /dev/null
+++ b/foundations/foundation-log/src/main/java/org/apache/servicecomb/foundation/log/server/ServerDefaultInitializer.java
@@ -0,0 +1,34 @@
+package org.apache.servicecomb.foundation.log.server;
+
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
+import org.apache.servicecomb.foundation.log.LogConfig;
+import org.apache.servicecomb.foundation.log.LogInitializer;
+import org.apache.servicecomb.foundation.log.core.LogGenerator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.eventbus.AllowConcurrentEvents;
+import com.google.common.eventbus.EventBus;
+import com.google.common.eventbus.Subscribe;
+
+public class ServerDefaultInitializer implements LogInitializer {
+
+  private static Logger LOGGER = LoggerFactory.getLogger("accesslog");
+
+  private LogGenerator logGenerator;
+
+  @Override
+  public void init(EventBus eventBus, LogConfig logConfig) {
+    if (!logConfig.isServerLogEnabled()) {
+      return;
+    }
+    logGenerator = new LogGenerator(logConfig.getServerLogPattern());
+    eventBus.register(this);
+  }
+
+  @Subscribe
+  @AllowConcurrentEvents
+  public void onRequestReceived(ServerAccessLogEvent accessLogEvent) {
+    LOGGER.info(logGenerator.generateServerLog(accessLogEvent));
+  }
+}
diff --git a/foundations/foundation-log/src/main/resources/META-INF/services/org.apache.servicecomb.core.BootListener b/foundations/foundation-log/src/main/resources/META-INF/services/org.apache.servicecomb.core.BootListener
new file mode 100644
index 0000000..cc656a8
--- /dev/null
+++ b/foundations/foundation-log/src/main/resources/META-INF/services/org.apache.servicecomb.core.BootListener
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.servicecomb.foundation.log.LogBootListener
\ No newline at end of file
diff --git a/foundations/foundation-log/src/main/resources/META-INF/services/org.apache.servicecomb.foundation.log.LogInitializer b/foundations/foundation-log/src/main/resources/META-INF/services/org.apache.servicecomb.foundation.log.LogInitializer
new file mode 100644
index 0000000..fd4421f
--- /dev/null
+++ b/foundations/foundation-log/src/main/resources/META-INF/services/org.apache.servicecomb.foundation.log.LogInitializer
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.servicecomb.foundation.log.client.ClientDefaultInitializer
+org.apache.servicecomb.foundation.log.server.ServerDefaultInitializer
diff --git a/foundations/foundation-log/src/main/resources/META-INF/services/org.apache.servicecomb.foundation.log.core.parser.VertxRestLogItemMeta b/foundations/foundation-log/src/main/resources/META-INF/services/org.apache.servicecomb.foundation.log.core.parser.VertxRestLogItemMeta
new file mode 100644
index 0000000..83453b4
--- /dev/null
+++ b/foundations/foundation-log/src/main/resources/META-INF/services/org.apache.servicecomb.foundation.log.core.parser.VertxRestLogItemMeta
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.servicecomb.foundation.log.core.parser.impl.DefaultCompositeVertxRestLogItemMeta
\ No newline at end of file
diff --git a/transports/transport-rest/transport-rest-vertx/pom.xml b/transports/transport-rest/transport-rest-vertx/pom.xml
index 010e871..7bc43d9 100644
--- a/transports/transport-rest/transport-rest-vertx/pom.xml
+++ b/transports/transport-rest/transport-rest-vertx/pom.xml
@@ -32,7 +32,10 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>transport-rest-client</artifactId>
     </dependency>
-
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>foundation-log</artifactId>
+    </dependency>
     <dependency>
       <groupId>io.vertx</groupId>
       <artifactId>vertx-codegen</artifactId>
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java
index 89c1dd4..15de1da 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java
@@ -26,10 +26,14 @@ import javax.ws.rs.core.MediaType;
 
 import org.apache.servicecomb.common.rest.codec.RestObjectMapperFactory;
 import org.apache.servicecomb.core.Endpoint;
+import org.apache.servicecomb.core.event.ServerAccessLogEvent;
 import org.apache.servicecomb.core.transport.AbstractTransport;
+import org.apache.servicecomb.foundation.common.event.EventManager;
 import org.apache.servicecomb.foundation.common.net.URIEndpointObject;
 import org.apache.servicecomb.foundation.common.utils.ExceptionUtils;
 import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
+import org.apache.servicecomb.foundation.log.LogConfig;
+import org.apache.servicecomb.foundation.log.core.element.impl.LocalHostItem;
 import org.apache.servicecomb.foundation.ssl.SSLCustom;
 import org.apache.servicecomb.foundation.ssl.SSLOption;
 import org.apache.servicecomb.foundation.ssl.SSLOptionFactory;
@@ -38,8 +42,6 @@ import org.apache.servicecomb.foundation.vertx.metrics.DefaultHttpServerMetrics;
 import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultServerEndpointMetric;
 import org.apache.servicecomb.swagger.invocation.exception.CommonExceptionData;
 import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogConfiguration;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.impl.AccessLogHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -161,14 +163,19 @@ public class RestServerVerticle extends AbstractVerticle {
   }
 
   private void mountAccessLogHandler(Router mainRouter) {
-    if (AccessLogConfiguration.INSTANCE.getAccessLogEnabled()) {
-      String pattern = AccessLogConfiguration.INSTANCE.getAccesslogPattern();
-      LOGGER.info("access log enabled, pattern = {}", pattern);
-      mainRouter.route()
-          .handler(new AccessLogHandler(
-              pattern
-          ));
+    if (!LogConfig.INSTANCE.isServerLogEnabled()) {
+      return;
     }
+    LOGGER.info("access log enabled, pattern = {}", LogConfig.INSTANCE.getServerLogPattern());
+    mainRouter.route().handler(context -> {
+      ServerAccessLogEvent accessLogEvent = new ServerAccessLogEvent()
+          .setRoutingContext(context)
+          .setMilliStartTime(System.currentTimeMillis())
+          .setLocalAddress(LocalHostItem.getLocalAddress(context));
+      context.response().endHandler(event ->
+          EventManager.post(accessLogEvent.setMilliEndTime(System.currentTimeMillis())));
+      context.next();
+    });
   }
 
   /**
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogConfiguration.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogConfiguration.java
deleted file mode 100644
index eee4307..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogConfiguration.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog;
-
-import com.netflix.config.DynamicPropertyFactory;
-
-public final class AccessLogConfiguration {
-
-  private static final String BASE = "servicecomb.accesslog.";
-
-  private static final String ACCESSLOG_ENABLED = BASE + "enabled";
-
-  private static final String ACCESSLOG_PATTERN = BASE + "pattern";
-
-  public static final AccessLogConfiguration INSTANCE = new AccessLogConfiguration();
-
-  public static final String DEFAULT_PATTERN = "%h - - %t %r %s %B %D";
-
-  private AccessLogConfiguration() {
-
-  }
-
-  public boolean getAccessLogEnabled() {
-    return getBooleanProperty(false, ACCESSLOG_ENABLED);
-  }
-
-  public String getAccesslogPattern() {
-    return getProperty(DEFAULT_PATTERN, ACCESSLOG_PATTERN);
-  }
-
-  private String getProperty(String defaultValue, String key) {
-    return DynamicPropertyFactory.getInstance().getStringProperty(key, defaultValue).get();
-  }
-
-  private boolean getBooleanProperty(boolean defaultValue, String key) {
-    return DynamicPropertyFactory.getInstance().getBooleanProperty(key, defaultValue).get();
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGenerator.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGenerator.java
deleted file mode 100644
index 27d8e0c..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGenerator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog;
-
-import java.util.List;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.AccessLogPatternParser;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.impl.VertxRestAccessLogPatternParser;
-
-import com.google.common.collect.Iterables;
-
-import io.vertx.ext.web.RoutingContext;
-
-/*
- * Accept {@link AccessLogParam} and generate access log.
- * <br/>
- * Each AccessLogParam for a line of access log.
- */
-public class AccessLogGenerator {
-  /*
-   * traversal this array to generate access log segment.
-   */
-  private AccessLogItem<RoutingContext>[] accessLogItems;
-
-  private AccessLogPatternParser<RoutingContext> accessLogPatternParser = new VertxRestAccessLogPatternParser();
-
-  @SuppressWarnings("unchecked")
-  public AccessLogGenerator(String rawPattern) {
-    List<AccessLogItem<RoutingContext>> accessLogItemList = accessLogPatternParser.parsePattern(rawPattern);
-    accessLogItems = Iterables.toArray(accessLogItemList, AccessLogItem.class);
-  }
-
-  public String generateLog(AccessLogParam<RoutingContext> accessLogParam) {
-    StringBuilder log = new StringBuilder(128);
-    accessLogParam.setEndMillisecond(System.currentTimeMillis());
-
-    AccessLogItem<RoutingContext>[] accessLogItems = getAccessLogItems();
-    for (int i = 0; i < accessLogItems.length; ++i) {
-      log.append(accessLogItems[i].getFormattedItem(accessLogParam));
-    }
-
-    return log.toString();
-  }
-
-  private AccessLogItem<RoutingContext>[] getAccessLogItems() {
-    return accessLogItems;
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogParam.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogParam.java
deleted file mode 100644
index 809030f..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogParam.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog;
-
-/**
- * carry the data used in access log.
- */
-public class AccessLogParam<T> {
-  /**
-   * data object that contains request and response information.
-   * For example, in vertx rest transport it's {@link io.vertx.ext.web.RoutingContext}
-   */
-  private T contextData;
-
-  private long startMillisecond;
-
-  private long endMillisecond;
-
-  /**
-   * If client send request via a short-lived connection, the connection may be closed before the corresponding
-   * access log is generated, and then the
-   * {@linkplain org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.LocalHostItem LocalHostItem}
-   * may get "0.0.0.0" as result. So we need to get local address before the connection is closed.
-   */
-  private String localAddress;
-
-  public T getContextData() {
-    return contextData;
-  }
-
-  public AccessLogParam<T> setContextData(T contextData) {
-    this.contextData = contextData;
-    return this;
-  }
-
-  public long getStartMillisecond() {
-    return startMillisecond;
-  }
-
-  public AccessLogParam<T> setStartMillisecond(long startMillisecond) {
-    this.startMillisecond = startMillisecond;
-    return this;
-  }
-
-  public long getEndMillisecond() {
-    return endMillisecond;
-  }
-
-  public AccessLogParam<T> setEndMillisecond(long endMillisecond) {
-    this.endMillisecond = endMillisecond;
-    return this;
-  }
-
-  public String getLocalAddress() {
-    return localAddress;
-  }
-
-  public AccessLogParam<T> setLocalAddress(String localAddress) {
-    this.localAddress = localAddress;
-    return this;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder("AccessLogParam{");
-    sb.append("contextData=").append(contextData);
-    sb.append(", startMillisecond=").append(startMillisecond);
-    sb.append(", endMillisecond=").append(endMillisecond);
-    sb.append(", localAddress='").append(localAddress).append('\'');
-    sb.append('}');
-    return sb.toString();
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/CookieItem.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/CookieItem.java
deleted file mode 100644
index 331ef60..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/CookieItem.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import java.util.Map;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-
-import io.vertx.core.http.Cookie;
-import io.vertx.ext.web.RoutingContext;
-
-public class CookieItem implements AccessLogItem<RoutingContext> {
-
-  public static final String RESULT_NOT_FOUND = "-";
-
-  private final String varName;
-
-  public CookieItem(String varName) {
-    this.varName = varName;
-  }
-
-  @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    Map<String, Cookie> cookieMap = accessLogParam.getContextData().cookieMap();
-    if (null == cookieMap) {
-      return RESULT_NOT_FOUND;
-    }
-
-    String result = null;
-    for (Cookie cookie : cookieMap.values()) {
-      if (varName.equals(cookie.getName())) {
-        result = cookie.getValue();
-      }
-    }
-
-    if (null == result) {
-      return RESULT_NOT_FOUND;
-    }
-
-    return result;
-  }
-
-  public String getVarName() {
-    return varName;
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItem.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItem.java
deleted file mode 100644
index 88980a3..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItem.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-
-import io.vertx.ext.web.RoutingContext;
-
-public class DurationMillisecondItem implements AccessLogItem<RoutingContext> {
-  @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    return String.valueOf(accessLogParam.getEndMillisecond() - accessLogParam.getStartMillisecond());
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItem.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItem.java
deleted file mode 100644
index b8ec486..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItem.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-
-import io.vertx.ext.web.RoutingContext;
-
-public class DurationSecondItem implements AccessLogItem<RoutingContext> {
-  @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    return String.valueOf((accessLogParam.getEndMillisecond() - accessLogParam.getStartMillisecond()) / 1000);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/FirstLineOfRequestItem.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/FirstLineOfRequestItem.java
deleted file mode 100644
index c3b37bb..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/FirstLineOfRequestItem.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-
-import io.vertx.ext.web.RoutingContext;
-
-public class FirstLineOfRequestItem implements AccessLogItem<RoutingContext> {
-  private static final HttpMethodItem METHOD_ELEMENT = new HttpMethodItem();
-
-  private static final UrlPathItem URI_PATH_ONLY_ELEMENT = new UrlPathItem();
-
-  private static final RequestProtocolItem VERSION_OR_PROTOCOL_ELEMENT = new RequestProtocolItem();
-
-  @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    StringBuilder result = new StringBuilder(64)
-        .append("\"")
-        .append(METHOD_ELEMENT.getFormattedItem(accessLogParam))
-        .append(" ")
-        .append(URI_PATH_ONLY_ELEMENT.getFormattedItem(accessLogParam))
-        .append(" ")
-        .append(VERSION_OR_PROTOCOL_ELEMENT.getFormattedItem(accessLogParam))
-        .append("\"");
-
-    return result.toString();
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/HttpMethodItem.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/HttpMethodItem.java
deleted file mode 100644
index 866e5b7..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/HttpMethodItem.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-
-import io.vertx.core.http.HttpMethod;
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.ext.web.RoutingContext;
-
-/**
- * HTTP method
- */
-public class HttpMethodItem implements AccessLogItem<RoutingContext> {
-
-  public static final String EMPTY_RESULT = "-";
-
-  @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    HttpServerRequest request = accessLogParam.getContextData().request();
-    if (null == request) {
-      return EMPTY_RESULT;
-    }
-
-    HttpMethod method = request.method();
-    if (null == method) {
-      return EMPTY_RESULT;
-    }
-    return method.toString();
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/LocalPortItem.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/LocalPortItem.java
deleted file mode 100644
index 3209d96..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/LocalPortItem.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.core.net.SocketAddress;
-import io.vertx.ext.web.RoutingContext;
-
-public class LocalPortItem implements AccessLogItem<RoutingContext> {
-
-  public static final String EMPTY_RESULT = "-";
-
-  @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    HttpServerRequest request = accessLogParam.getContextData().request();
-    if (null == request) {
-      return EMPTY_RESULT;
-    }
-
-    SocketAddress localAddress = request.localAddress();
-    if (null == localAddress) {
-      return EMPTY_RESULT;
-    }
-
-    return String.valueOf(localAddress.port());
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RemoteHostItem.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RemoteHostItem.java
deleted file mode 100644
index 82ace24..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RemoteHostItem.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-import org.springframework.util.StringUtils;
-
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.core.net.SocketAddress;
-import io.vertx.ext.web.RoutingContext;
-
-public class RemoteHostItem implements AccessLogItem<RoutingContext> {
-
-  public static final String EMPTY_RESULT = "-";
-
-  @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    HttpServerRequest request = accessLogParam.getContextData().request();
-    if (null == request) {
-      return EMPTY_RESULT;
-    }
-
-    SocketAddress remoteAddress = request.remoteAddress();
-    if (null == remoteAddress) {
-      return EMPTY_RESULT;
-    }
-
-    String remoteHost = remoteAddress.host();
-    if (StringUtils.isEmpty(remoteHost)) {
-      return EMPTY_RESULT;
-    }
-    return remoteHost;
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RequestHeaderItem.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RequestHeaderItem.java
deleted file mode 100644
index 94a463d..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RequestHeaderItem.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-
-import io.vertx.core.MultiMap;
-import io.vertx.ext.web.RoutingContext;
-
-public class RequestHeaderItem implements AccessLogItem<RoutingContext> {
-
-  public static final String RESULT_NOT_FOUND = "-";
-
-  private final String varName;
-
-  public RequestHeaderItem(String varName) {
-    this.varName = varName;
-  }
-
-  @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    MultiMap headers = accessLogParam.getContextData().request().headers();
-    if (null == headers) {
-      return "-";
-    }
-
-    String result = headers.get(varName);
-
-    if (null == result) {
-      return RESULT_NOT_FOUND;
-    }
-
-    return result;
-  }
-
-  public String getVarName() {
-    return varName;
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/ResponseHeaderItem.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/ResponseHeaderItem.java
deleted file mode 100644
index af8cfbb..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/ResponseHeaderItem.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-
-import io.vertx.core.MultiMap;
-import io.vertx.core.http.HttpServerResponse;
-import io.vertx.ext.web.RoutingContext;
-
-public class ResponseHeaderItem implements AccessLogItem<RoutingContext> {
-
-  public static final String RESULT_NOT_FOUND = "-";
-
-  private final String varName;
-
-  public ResponseHeaderItem(String varName) {
-    this.varName = varName;
-  }
-
-  @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    HttpServerResponse response = accessLogParam.getContextData().response();
-    if (null == response) {
-      return RESULT_NOT_FOUND;
-    }
-
-    MultiMap headers = response.headers();
-    if (null == headers) {
-      return RESULT_NOT_FOUND;
-    }
-
-    String result = headers.get(varName);
-    if (null == result) {
-      return RESULT_NOT_FOUND;
-    }
-
-    return result;
-  }
-
-  public String getVarName() {
-    return varName;
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UrlPathWithQueryItem.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UrlPathWithQueryItem.java
deleted file mode 100644
index 2d65985..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UrlPathWithQueryItem.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-import org.springframework.util.StringUtils;
-
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.ext.web.RoutingContext;
-
-public class UrlPathWithQueryItem implements AccessLogItem<RoutingContext> {
-
-  public static final String EMPTY_RESULT = "-";
-
-  @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    HttpServerRequest request = accessLogParam.getContextData().request();
-    if (null == request) {
-      return EMPTY_RESULT;
-    }
-
-    String uri = request.uri();
-    if (StringUtils.isEmpty(uri)) {
-      return EMPTY_RESULT;
-    }
-
-    return uri;
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/impl/AccessLogHandler.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/impl/AccessLogHandler.java
deleted file mode 100644
index 0edc7c0..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/impl/AccessLogHandler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogGenerator;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.LocalHostItem;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import io.vertx.core.Handler;
-import io.vertx.ext.web.RoutingContext;
-
-public class AccessLogHandler implements Handler<RoutingContext> {
-  private static Logger LOGGER = LoggerFactory.getLogger("accesslog");
-
-  private AccessLogGenerator accessLogGenerator;
-
-  public AccessLogHandler(String rawPattern) {
-    accessLogGenerator = new AccessLogGenerator(rawPattern);
-  }
-
-  @Override
-  public void handle(RoutingContext context) {
-    AccessLogParam<RoutingContext> accessLogParam = getRoutingContextAccessLogParam(context);
-
-    context.response().endHandler(event -> LOGGER.info(accessLogGenerator.generateLog(accessLogParam)));
-
-    context.next();
-  }
-
-  private AccessLogParam<RoutingContext> getRoutingContextAccessLogParam(RoutingContext context) {
-    AccessLogParam<RoutingContext> accessLogParam = new AccessLogParam<>();
-    accessLogParam.setStartMillisecond(System.currentTimeMillis()).setContextData(context);
-    accessLogParam.setLocalAddress(LocalHostItem.getLocalAddress(accessLogParam));
-    return accessLogParam;
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/DefaultCompositeVertxRestAccessLogItemMeta.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/DefaultCompositeVertxRestAccessLogItemMeta.java
deleted file mode 100644
index aaaf9f0..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/DefaultCompositeVertxRestAccessLogItemMeta.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.parser.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.CookieItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.DatetimeConfigurableItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.DurationMillisecondItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.DurationSecondItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.FirstLineOfRequestItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.HttpMethodItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.HttpStatusItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.InvocationContextItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.LocalHostItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.LocalPortItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.QueryStringItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.RemoteHostItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.RequestHeaderItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.RequestProtocolItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.ResponseHeaderItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.ResponseSizeItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.TraceIdItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.UrlPathItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.UrlPathWithQueryItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.CompositeVertxRestAccessLogItemMeta;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.VertxRestAccessLogItemMeta;
-
-import io.vertx.ext.web.RoutingContext;
-
-public class DefaultCompositeVertxRestAccessLogItemMeta extends CompositeVertxRestAccessLogItemMeta {
-  private static final List<VertxRestAccessLogItemMeta> SUPPORTED_META = new ArrayList<>();
-
-  static {
-    final AccessLogItem<RoutingContext> httpMethodItem = new HttpMethodItem();
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%m", config -> httpMethodItem));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("cs-method", config -> httpMethodItem));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%s", config -> new HttpStatusItem()));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("sc-status", config -> new HttpStatusItem()));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%T", config -> new DurationSecondItem()));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%D", config -> new DurationMillisecondItem()));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%h", config -> new RemoteHostItem()));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%v", config -> new LocalHostItem()));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%p", config -> new LocalPortItem()));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%B", config -> new ResponseSizeItem("0")));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%b", config -> new ResponseSizeItem("-")));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%r", config -> new FirstLineOfRequestItem()));
-    final AccessLogItem<RoutingContext> urlPathItem = new UrlPathItem();
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%U", config -> urlPathItem));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("cs-uri-stem", config -> urlPathItem));
-    final AccessLogItem<RoutingContext> queryStringItem = new QueryStringItem();
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%q", config -> queryStringItem));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("cs-uri-query", config -> queryStringItem));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("cs-uri", config -> new UrlPathWithQueryItem()));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%H", config -> new RequestProtocolItem()));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%t", config -> new DatetimeConfigurableItem()));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%SCB-traceId", config -> new TraceIdItem()));
-
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%{", "}t", DatetimeConfigurableItem::new));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%{", "}i", RequestHeaderItem::new));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%{", "}o", ResponseHeaderItem::new));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%{", "}C", CookieItem::new));
-    SUPPORTED_META.add(new VertxRestAccessLogItemMeta("%{", "}SCB-ctx", InvocationContextItem::new));
-  }
-
-  @Override
-  public List<VertxRestAccessLogItemMeta> getAccessLogItemMetas() {
-    return SUPPORTED_META;
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogConfigurationTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogConfigurationTest.java
deleted file mode 100644
index 0dd1af6..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogConfigurationTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
-import org.junit.Test;
-
-public class AccessLogConfigurationTest {
-
-  @Test
-  public void getAccessLogEnabled() {
-    boolean result = AccessLogConfiguration.INSTANCE.getAccessLogEnabled();
-    assertFalse(result);
-  }
-
-  @Test
-  public void getAccesslogPattern() {
-    String result = AccessLogConfiguration.INSTANCE.getAccesslogPattern();
-    assertEquals("%h - - %t %r %s %B %D", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGeneratorTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGeneratorTest.java
deleted file mode 100644
index 1df6609..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGeneratorTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog;
-
-import static org.junit.Assert.assertEquals;
-
-import java.text.SimpleDateFormat;
-import java.util.TimeZone;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.DatetimeConfigurableItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.HttpMethodItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.PlainTextItem;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpMethod;
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.ext.web.RoutingContext;
-import mockit.Deencapsulation;
-
-public class AccessLogGeneratorTest {
-
-  private static final AccessLogGenerator ACCESS_LOG_GENERATOR = new AccessLogGenerator("%m - %t");
-
-  @Test
-  public void testConstructor() {
-    AccessLogItem<RoutingContext>[] elements = Deencapsulation.getField(ACCESS_LOG_GENERATOR, "accessLogItems");
-    assertEquals(3, elements.length);
-    assertEquals(HttpMethodItem.class, elements[0].getClass());
-    assertEquals(PlainTextItem.class, elements[1].getClass());
-    assertEquals(DatetimeConfigurableItem.class, elements[2].getClass());
-  }
-
-  @Test
-  public void testLog() {
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    long startMillisecond = 1416863450581L;
-    AccessLogParam<RoutingContext> accessLogParam = new AccessLogParam<>();
-    accessLogParam.setStartMillisecond(startMillisecond).setContextData(context);
-    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DatetimeConfigurableItem.DEFAULT_DATETIME_PATTERN,
-        DatetimeConfigurableItem.DEFAULT_LOCALE);
-    simpleDateFormat.setTimeZone(TimeZone.getDefault());
-
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.method()).thenReturn(HttpMethod.DELETE);
-
-    String log = ACCESS_LOG_GENERATOR.generateLog(accessLogParam);
-
-    Assert.assertEquals("DELETE" + " - " + simpleDateFormat.format(startMillisecond), log);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/CookieItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/CookieItemTest.java
deleted file mode 100644
index 68db0db..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/CookieItemTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import java.util.HashMap;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.Cookie;
-import io.vertx.ext.web.RoutingContext;
-import io.vertx.ext.web.impl.CookieImpl;
-
-public class CookieItemTest {
-
-  public static final String COOKIE_NAME = "cookieName";
-
-  private static final CookieItem ELEMENT = new CookieItem(COOKIE_NAME);
-
-  @Test
-  public void getFormattedElement() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-    HashMap<String, Cookie> cookieSet = new HashMap<>();
-    String cookieValue = "cookieValue";
-    CookieImpl cookie = new CookieImpl(COOKIE_NAME, cookieValue);
-
-    cookieSet.put(cookie.getName(), cookie);
-    Mockito.when(mockContext.cookieCount()).thenReturn(1);
-    Mockito.when(mockContext.cookieMap()).thenReturn(cookieSet);
-    param.setContextData(mockContext);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    Assert.assertEquals(cookieValue, result);
-  }
-
-  @Test
-  public void getFormattedElementOnCookieCountIsZero() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-    HashMap<String, Cookie> cookieSet = new HashMap<>();
-
-    Mockito.when(mockContext.cookieCount()).thenReturn(0);
-    Mockito.when(mockContext.cookieMap()).thenReturn(cookieSet);
-    param.setContextData(mockContext);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    Assert.assertEquals("-", result);
-  }
-
-  @Test
-  public void getFormattedElementOnCookieSetIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-
-    Mockito.when(mockContext.cookieCount()).thenReturn(1);
-    Mockito.when(mockContext.cookieMap()).thenReturn(null);
-    param.setContextData(mockContext);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    Assert.assertEquals("-", result);
-  }
-
-  @Test
-  public void getFormattedElementOnNotFound() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-    HashMap<String, Cookie> cookieSet = new HashMap<>();
-    String cookieValue = "cookieValue";
-    CookieImpl cookie = new CookieImpl("anotherCookieName", cookieValue);
-
-    cookieSet.put(cookie.getName(), cookie);
-    Mockito.when(mockContext.cookieCount()).thenReturn(1);
-    Mockito.when(mockContext.cookieMap()).thenReturn(cookieSet);
-    param.setContextData(mockContext);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    Assert.assertEquals("-", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItemTest.java
deleted file mode 100644
index 17876ef..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItemTest.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import java.text.SimpleDateFormat;
-import java.util.Locale;
-import java.util.TimeZone;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-
-import io.vertx.ext.web.RoutingContext;
-
-public class DatetimeConfigurableItemTest {
-
-  private static final long START_MILLISECOND = 1416863450581L;
-
-  @Test
-  public void getFormattedElement() {
-    DatetimeConfigurableItem element = new DatetimeConfigurableItem(
-        "EEE, yyyy MMM dd HH:mm:ss zzz|GMT-08|zh-CN");
-
-    AccessLogParam<RoutingContext> accessLogParam =
-        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
-
-    String result = element.getFormattedItem(accessLogParam);
-
-    assertEquals("星期一, 2014 十一月 24 13:10:50 GMT-08:00", result);
-  }
-
-  @Test
-  public void getFormattedElementOnNoPattern() {
-    DatetimeConfigurableItem element = new DatetimeConfigurableItem(
-        "|GMT+08|zh-CN");
-
-    AccessLogParam<RoutingContext> accessLogParam =
-        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
-
-    String result = element.getFormattedItem(accessLogParam);
-
-    assertEquals("星期二, 25 十一月 2014 05:10:50 GMT+08:00", result);
-  }
-
-  @Test
-  public void getFormattedElementOnNoTimezone() {
-    DatetimeConfigurableItem element = new DatetimeConfigurableItem(
-        "yyyy/MM/dd zzz||zh-CN");
-    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd zzz", Locale.forLanguageTag("zh-CN"));
-    simpleDateFormat.setTimeZone(TimeZone.getDefault());
-
-    AccessLogParam<RoutingContext> accessLogParam =
-        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
-
-    String result = element.getFormattedItem(accessLogParam);
-
-    assertEquals(simpleDateFormat.format(START_MILLISECOND), result);
-  }
-
-  @Test
-  public void getFormattedElementOnNoLocale() {
-    DatetimeConfigurableItem element = new DatetimeConfigurableItem(
-        "EEE, dd MMM yyyy HH:mm:ss zzz|GMT+08|");
-
-    AccessLogParam<RoutingContext> accessLogParam =
-        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
-
-    String result = element.getFormattedItem(accessLogParam);
-
-    assertEquals("Tue, 25 Nov 2014 05:10:50 GMT+08:00", result);
-  }
-
-  @Test
-  public void getFormattedElementOnNoConfig() {
-    DatetimeConfigurableItem element = new DatetimeConfigurableItem(
-        "||");
-    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DatetimeConfigurableItem.DEFAULT_DATETIME_PATTERN,
-        Locale.US);
-    simpleDateFormat.setTimeZone(TimeZone.getDefault());
-    AccessLogParam<RoutingContext> accessLogParam =
-        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
-
-    String result = element.getFormattedItem(accessLogParam);
-
-    assertEquals(simpleDateFormat.format(START_MILLISECOND), result);
-  }
-
-  @Test
-  public void testConstructorWithNoArg() {
-    DatetimeConfigurableItem element = new DatetimeConfigurableItem();
-    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
-    simpleDateFormat.setTimeZone(TimeZone.getDefault());
-    AccessLogParam<RoutingContext> accessLogParam =
-        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
-
-    String result = element.getFormattedItem(accessLogParam);
-
-    assertEquals("EEE, dd MMM yyyy HH:mm:ss zzz", element.getPattern());
-    assertEquals(Locale.US, element.getLocale());
-    assertEquals(TimeZone.getDefault(), element.getTimezone());
-    assertEquals(simpleDateFormat.format(START_MILLISECOND), result);
-  }
-
-  @Test
-  public void testConstructorWithNoSeparator() {
-    DatetimeConfigurableItem element = new DatetimeConfigurableItem("yyyy/MM/dd HH:mm:ss zzz");
-    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss zzz", Locale.US);
-    simpleDateFormat.setTimeZone(TimeZone.getDefault());
-    AccessLogParam<RoutingContext> accessLogParam =
-        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
-
-    String result = element.getFormattedItem(accessLogParam);
-
-    assertEquals("yyyy/MM/dd HH:mm:ss zzz", element.getPattern());
-    assertEquals(Locale.US, element.getLocale());
-    assertEquals(TimeZone.getDefault(), element.getTimezone());
-    assertEquals(simpleDateFormat.format(START_MILLISECOND), result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItemTest.java
deleted file mode 100644
index 88e18f0..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItemTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-
-import io.vertx.ext.web.RoutingContext;
-
-public class DurationMillisecondItemTest {
-
-  public static final DurationMillisecondItem ELEMENT = new DurationMillisecondItem();
-
-  @Test
-  public void getFormattedElement() {
-    AccessLogParam<RoutingContext> param =
-        new AccessLogParam<RoutingContext>().setStartMillisecond(1L).setEndMillisecond(2L);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("1", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItemTest.java
deleted file mode 100644
index 6f99e47..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItemTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-
-import io.vertx.ext.web.RoutingContext;
-
-public class DurationSecondItemTest {
-
-  public static final DurationSecondItem ELEMENT = new DurationSecondItem();
-
-  @Test
-  public void getFormattedElementOn999ms() {
-    AccessLogParam<RoutingContext> param =
-        new AccessLogParam<RoutingContext>().setStartMillisecond(1L).setEndMillisecond(1000L);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("0", result);
-  }
-
-  @Test
-  public void getFormattedElementOn1000ms() {
-    AccessLogParam<RoutingContext> param =
-        new AccessLogParam<RoutingContext>().setStartMillisecond(1L).setEndMillisecond(1001L);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("1", result);
-  }
-
-  @Test
-  public void getFormattedElementOn1001ms() {
-    AccessLogParam<RoutingContext> param =
-        new AccessLogParam<RoutingContext>().setStartMillisecond(1L).setEndMillisecond(1002L);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("1", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/FirstLineOfRequestItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/FirstLineOfRequestItemTest.java
deleted file mode 100644
index db30ecf..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/FirstLineOfRequestItemTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpMethod;
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.core.http.HttpVersion;
-import io.vertx.ext.web.RoutingContext;
-
-public class FirstLineOfRequestItemTest {
-
-  public static final FirstLineOfRequestItem ELEMENT = new FirstLineOfRequestItem();
-
-  @Test
-  public void getFormattedElement() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    String uri = "/test/uri";
-
-    param.setContextData(mockContext);
-    Mockito.when(mockContext.request()).thenReturn(request);
-    Mockito.when(request.method()).thenReturn(HttpMethod.DELETE);
-    Mockito.when(request.path()).thenReturn(uri);
-    Mockito.when(request.version()).thenReturn(HttpVersion.HTTP_1_1);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("\"DELETE " + uri + " HTTP/1.1\"", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/HttpMethodItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/HttpMethodItemTest.java
deleted file mode 100644
index 82bb42f..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/HttpMethodItemTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpMethod;
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.ext.web.RoutingContext;
-
-public class HttpMethodItemTest {
-
-  @Test
-  public void getFormattedElement() {
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    Mockito.when(routingContext.request()).thenReturn(request);
-    Mockito.when(request.method()).thenReturn(HttpMethod.DELETE);
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    param.setContextData(routingContext);
-
-    Assert.assertEquals("DELETE", new HttpMethodItem().getFormattedItem(param));
-  }
-
-  @Test
-  public void getFormattedElementOnRequestIsNull() {
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    param.setContextData(routingContext);
-
-    Mockito.when(routingContext.request()).thenReturn(null);
-
-    Assert.assertEquals("-", new HttpMethodItem().getFormattedItem(param));
-  }
-
-  @Test
-  public void getFormattedElementOnMethodIsNull() {
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    param.setContextData(routingContext);
-
-    Mockito.when(routingContext.request()).thenReturn(request);
-    Mockito.when(request.method()).thenReturn(null);
-
-    Assert.assertEquals("-", new HttpMethodItem().getFormattedItem(param));
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/HttpStatusItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/HttpStatusItemTest.java
deleted file mode 100644
index 2ab6aef..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/HttpStatusItemTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpServerResponse;
-import io.vertx.ext.web.RoutingContext;
-
-public class HttpStatusItemTest {
-
-  private static final HttpStatusItem STATUS_ELEMENT = new HttpStatusItem();
-
-  @Test
-  public void getFormattedElement() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerResponse response = Mockito.mock(HttpServerResponse.class);
-    int statusCode = 200;
-
-    param.setContextData(context);
-    Mockito.when(context.response()).thenReturn(response);
-    Mockito.when(response.getStatusCode()).thenReturn(statusCode);
-
-    String result = STATUS_ELEMENT.getFormattedItem(param);
-
-    assertEquals("200", result);
-  }
-
-
-  @Test
-  public void getFormattedElementOnResponseIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerResponse response = Mockito.mock(HttpServerResponse.class);
-
-    param.setContextData(context);
-    Mockito.when(context.response()).thenReturn(null);
-
-    String result = STATUS_ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-
-    Mockito.when(context.response()).thenReturn(response);
-    Mockito.when(response.closed()).thenReturn(true);
-    Mockito.when(response.ended()).thenReturn(false);
-    result = STATUS_ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/InvocationContextItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/InvocationContextItemTest.java
deleted file mode 100644
index a3c39d4..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/InvocationContextItemTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.servicecomb.common.rest.RestConst;
-import org.apache.servicecomb.core.Invocation;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.hamcrest.Matchers;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.ext.web.RoutingContext;
-
-public class InvocationContextItemTest {
-
-  public static final String INVOCATION_CONTEXT_KEY = "testKey";
-
-  private static InvocationContextItem ITEM = new InvocationContextItem(INVOCATION_CONTEXT_KEY);
-
-  @Test
-  public void testGetFormattedItem() {
-    AccessLogParam<RoutingContext> accessLogParam = new AccessLogParam<>();
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-    Map<String, Object> routingContextData = new HashMap<>();
-    Invocation invocation = Mockito.mock(Invocation.class);
-    String testValue = "testValue";
-
-    accessLogParam.setContextData(routingContext);
-    Mockito.when(routingContext.data()).thenReturn(routingContextData);
-    routingContextData.put(RestConst.REST_INVOCATION_CONTEXT, invocation);
-    Mockito.when(invocation.getContext(INVOCATION_CONTEXT_KEY)).thenReturn(testValue);
-
-    String result = ITEM.getFormattedItem(accessLogParam);
-
-    Assert.assertThat(result, Matchers.is(testValue));
-  }
-
-  @Test
-  public void testGetFormattedItemOnInvocationContextValueNotFound() {
-    AccessLogParam<RoutingContext> accessLogParam = new AccessLogParam<>();
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-    Map<String, Object> routingContextData = new HashMap<>();
-    Invocation invocation = Mockito.mock(Invocation.class);
-
-    accessLogParam.setContextData(routingContext);
-    Mockito.when(routingContext.data()).thenReturn(routingContextData);
-    routingContextData.put(RestConst.REST_INVOCATION_CONTEXT, invocation);
-    Mockito.when(invocation.getContext(INVOCATION_CONTEXT_KEY)).thenReturn(null);
-
-    String result = ITEM.getFormattedItem(accessLogParam);
-
-    Assert.assertThat(result, Matchers.is(InvocationContextItem.NOT_FOUND));
-  }
-
-  @Test
-  public void testGetFormattedItemOnInvocationNotFound() {
-    AccessLogParam<RoutingContext> accessLogParam = new AccessLogParam<>();
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-    Map<String, Object> routingContextData = new HashMap<>();
-
-    accessLogParam.setContextData(routingContext);
-    Mockito.when(routingContext.data()).thenReturn(routingContextData);
-
-    String result = ITEM.getFormattedItem(accessLogParam);
-
-    Assert.assertThat(result, Matchers.is(InvocationContextItem.NOT_FOUND));
-  }
-
-  @Test
-  public void testGetFormattedItemOnRoutingContextDataNotFound() {
-    AccessLogParam<RoutingContext> accessLogParam = new AccessLogParam<>();
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-
-    accessLogParam.setContextData(routingContext);
-    Mockito.when(routingContext.data()).thenReturn(null);
-
-    String result = ITEM.getFormattedItem(accessLogParam);
-
-    Assert.assertThat(result, Matchers.is(InvocationContextItem.NOT_FOUND));
-  }
-}
\ No newline at end of file
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/LocalHostItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/LocalHostItemTest.java
deleted file mode 100644
index 285529d..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/LocalHostItemTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.core.net.SocketAddress;
-import io.vertx.ext.web.RoutingContext;
-
-public class LocalHostItemTest {
-
-  public static final LocalHostItem ELEMENT = new LocalHostItem();
-
-  @Test
-  public void getFormattedItem() {
-    String localAddress = "192.168.0.1";
-    AccessLogParam<RoutingContext> accessLogParam = new AccessLogParam<>();
-    accessLogParam.setLocalAddress(localAddress);
-
-    Assert.assertEquals(localAddress, ELEMENT.getFormattedItem(accessLogParam));
-  }
-
-  @Test
-  public void getLocalAddress() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    SocketAddress localAddress = Mockito.mock(SocketAddress.class);
-    String localHost = "testHost";
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.localAddress()).thenReturn(localAddress);
-    Mockito.when(localAddress.host()).thenReturn(localHost);
-
-    String result = LocalHostItem.getLocalAddress(param);
-
-    assertEquals(localHost, result);
-  }
-
-  @Test
-  public void getLocalAddressOnRequestIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(null);
-
-    String result = LocalHostItem.getLocalAddress(param);
-
-    assertEquals("-", result);
-  }
-
-  @Test
-  public void getLocalAddressOnLocalAddressIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.localAddress()).thenReturn(null);
-
-    String result = LocalHostItem.getLocalAddress(param);
-
-    assertEquals("-", result);
-  }
-
-  @Test
-  public void getLocalAddressOnHostIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    SocketAddress localAddress = Mockito.mock(SocketAddress.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.localAddress()).thenReturn(localAddress);
-    Mockito.when(localAddress.host()).thenReturn(null);
-
-    String result = LocalHostItem.getLocalAddress(param);
-
-    assertEquals("-", result);
-  }
-
-  @Test
-  public void getLocalAddressIsEmpty() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    SocketAddress localAddress = Mockito.mock(SocketAddress.class);
-    String localHost = "";
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.localAddress()).thenReturn(localAddress);
-    Mockito.when(localAddress.host()).thenReturn(localHost);
-
-    String result = LocalHostItem.getLocalAddress(param);
-
-    assertEquals("-", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/LocalPortItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/LocalPortItemTest.java
deleted file mode 100644
index e1ad26a..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/LocalPortItemTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.core.net.SocketAddress;
-import io.vertx.ext.web.RoutingContext;
-
-public class LocalPortItemTest {
-
-  @Test
-  public void getFormattedElement() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    SocketAddress localAddress = Mockito.mock(SocketAddress.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.localAddress()).thenReturn(localAddress);
-    Mockito.when(localAddress.port()).thenReturn(8080);
-
-    String result = new LocalPortItem().getFormattedItem(param);
-
-    assertEquals("8080", result);
-  }
-
-  @Test
-  public void getFormattedElementOnRequestIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(null);
-
-    String result = new LocalPortItem().getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-
-  @Test
-  public void getFormattedElementOnLocalAddressIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.localAddress()).thenReturn(null);
-
-    String result = new LocalPortItem().getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/QueryStringItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/QueryStringItemTest.java
deleted file mode 100644
index a653982..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/QueryStringItemTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.ext.web.RoutingContext;
-
-public class QueryStringItemTest {
-
-  @Test
-  public void getFormattedElement() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    String query = "?status=up";
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.query()).thenReturn(query);
-
-    String result = new QueryStringItem().getFormattedItem(param);
-
-    assertEquals(query, result);
-  }
-
-  @Test
-  public void getFormattedElementOnRequestIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(null);
-
-    String result = new QueryStringItem().getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-
-  @Test
-  public void getFormattedElementOnQueryIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.query()).thenReturn(null);
-
-    String result = new QueryStringItem().getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-
-  @Test
-  public void getFormattedElementOnQueryIsEmpty() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    String query = "";
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.query()).thenReturn(query);
-
-    String result = new QueryStringItem().getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RemoteHostItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RemoteHostItemTest.java
deleted file mode 100644
index 78f8ee3..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RemoteHostItemTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.core.net.SocketAddress;
-import io.vertx.ext.web.RoutingContext;
-
-public class RemoteHostItemTest {
-
-  public static final RemoteHostItem ELEMENT = new RemoteHostItem();
-
-  @Test
-  public void getFormattedElement() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    SocketAddress address = Mockito.mock(SocketAddress.class);
-    String remoteHost = "remoteHost";
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.remoteAddress()).thenReturn(address);
-    Mockito.when(address.host()).thenReturn(remoteHost);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals(remoteHost, result);
-  }
-
-  @Test
-  public void getFormattedElementOnRequestIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(null);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-
-
-  @Test
-  public void getFormattedElementOnRemoteAddressIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.remoteAddress()).thenReturn(null);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-
-
-  @Test
-  public void getFormattedElementOnHostIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    SocketAddress address = Mockito.mock(SocketAddress.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.remoteAddress()).thenReturn(address);
-    Mockito.when(address.host()).thenReturn(null);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-
-
-  @Test
-  public void getFormattedElementOnHostIsEmpty() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    SocketAddress address = Mockito.mock(SocketAddress.class);
-    String remoteHost = "";
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.remoteAddress()).thenReturn(address);
-    Mockito.when(address.host()).thenReturn(remoteHost);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RequestHeaderItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RequestHeaderItemTest.java
deleted file mode 100644
index f8a4196..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RequestHeaderItemTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.core.http.impl.headers.VertxHttpHeaders;
-import io.vertx.ext.web.RoutingContext;
-
-public class RequestHeaderItemTest {
-
-  private static final String VAR_NAME = "varName";
-
-  private static final RequestHeaderItem ELEMENT = new RequestHeaderItem(VAR_NAME);
-
-  @Test
-  public void getFormattedElement() {
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    param.setContextData(mockContext);
-    HttpServerRequest mockRequest = Mockito.mock(HttpServerRequest.class);
-    VertxHttpHeaders headers = new VertxHttpHeaders();
-    String testValue = "testValue";
-    headers.add(VAR_NAME, testValue);
-
-    Mockito.when(mockContext.request()).thenReturn(mockRequest);
-    Mockito.when(mockRequest.headers()).thenReturn(headers);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals(testValue, result);
-    assertEquals(ELEMENT.getVarName(), VAR_NAME);
-  }
-
-  @Test
-  public void getFormattedElementIfHeaderIsNull() {
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    param.setContextData(mockContext);
-    HttpServerRequest mockRequest = Mockito.mock(HttpServerRequest.class);
-
-    Mockito.when(mockContext.request()).thenReturn(mockRequest);
-    Mockito.when(mockRequest.headers()).thenReturn(null);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-
-  @Test
-  public void getFormattedElementIfNotFound() {
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    param.setContextData(mockContext);
-    HttpServerRequest mockRequest = Mockito.mock(HttpServerRequest.class);
-    VertxHttpHeaders headers = new VertxHttpHeaders();
-    String testValue = "testValue";
-    headers.add("anotherHeader", testValue);
-
-    Mockito.when(mockContext.request()).thenReturn(mockRequest);
-    Mockito.when(mockRequest.headers()).thenReturn(headers);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RequestProtocolItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RequestProtocolItemTest.java
deleted file mode 100644
index f5c90c7..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/RequestProtocolItemTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.core.http.HttpVersion;
-import io.vertx.ext.web.RoutingContext;
-
-public class RequestProtocolItemTest {
-
-  @Test
-  public void getFormattedElement() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.version()).thenReturn(HttpVersion.HTTP_1_1);
-
-    String result = new RequestProtocolItem().getFormattedItem(param);
-    assertEquals("HTTP/1.1", result);
-
-    Mockito.when(request.version()).thenReturn(HttpVersion.HTTP_1_0);
-    result = new RequestProtocolItem().getFormattedItem(param);
-    assertEquals("HTTP/1.0", result);
-
-    Mockito.when(request.version()).thenReturn(HttpVersion.HTTP_2);
-    result = new RequestProtocolItem().getFormattedItem(param);
-    assertEquals("HTTP/2.0", result);
-  }
-
-  @Test
-  public void getFormattedElementOnRequestIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(null);
-
-    String result = new RequestProtocolItem().getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-
-
-  @Test
-  public void getFormattedElementOnVersionIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.version()).thenReturn(null);
-
-    String result = new RequestProtocolItem().getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/ResponseHeaderItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/ResponseHeaderItemTest.java
deleted file mode 100644
index 47593d6..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/ResponseHeaderItemTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpServerResponse;
-import io.vertx.core.http.impl.headers.VertxHttpHeaders;
-import io.vertx.ext.web.RoutingContext;
-
-public class ResponseHeaderItemTest {
-
-  private static final String VAR_NAME = "varName";
-
-  private static final ResponseHeaderItem ELEMENT = new ResponseHeaderItem(VAR_NAME);
-
-  @Test
-  public void getFormattedElement() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-    HttpServerResponse mockResponse = Mockito.mock(HttpServerResponse.class);
-    VertxHttpHeaders headers = new VertxHttpHeaders();
-    String headerValue = "headerValue";
-
-    param.setContextData(mockContext);
-    headers.add(VAR_NAME, headerValue);
-
-    Mockito.when(mockContext.response()).thenReturn(mockResponse);
-    Mockito.when(mockResponse.headers()).thenReturn(headers);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals(headerValue, result);
-    assertEquals(ELEMENT.getVarName(), VAR_NAME);
-  }
-
-  @Test
-  public void getFormattedElementOnHeadersIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-    HttpServerResponse mockResponse = Mockito.mock(HttpServerResponse.class);
-
-    param.setContextData(mockContext);
-
-    Mockito.when(mockContext.response()).thenReturn(mockResponse);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-
-  @Test
-  public void getFormattedElementOnResponseIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-
-    param.setContextData(mockContext);
-
-    Mockito.when(mockContext.response()).thenReturn(null);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-
-  @Test
-  public void getFormattedElementOnNotFound() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-    HttpServerResponse mockResponse = Mockito.mock(HttpServerResponse.class);
-    VertxHttpHeaders headers = new VertxHttpHeaders();
-    String headerValue = "headerValue";
-
-    param.setContextData(mockContext);
-    headers.add("anotherHeader", headerValue);
-
-    Mockito.when(mockContext.response()).thenReturn(mockResponse);
-    Mockito.when(mockResponse.headers()).thenReturn(headers);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/ResponseSizeItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/ResponseSizeItemTest.java
deleted file mode 100644
index dd7576f..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/ResponseSizeItemTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpServerResponse;
-import io.vertx.ext.web.RoutingContext;
-
-public class ResponseSizeItemTest {
-
-  private static final ResponseSizeItem ELEMENT = new ResponseSizeItem("0");
-
-  @Test
-  public void getFormattedElement() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-    HttpServerResponse mockResponse = Mockito.mock(HttpServerResponse.class);
-    long bytesWritten = 16L;
-
-    param.setContextData(mockContext);
-    Mockito.when(mockContext.response()).thenReturn(mockResponse);
-    Mockito.when(mockResponse.bytesWritten()).thenReturn(bytesWritten);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals(String.valueOf(bytesWritten), result);
-  }
-
-  @Test
-  public void getFormattedElementOnResponseIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-
-    param.setContextData(mockContext);
-    Mockito.when(mockContext.response()).thenReturn(null);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("0", result);
-  }
-
-
-  @Test
-  public void getFormattedElementOnBytesWrittenIsZero() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext mockContext = Mockito.mock(RoutingContext.class);
-    HttpServerResponse mockResponse = Mockito.mock(HttpServerResponse.class);
-    long bytesWritten = 0L;
-
-    param.setContextData(mockContext);
-    Mockito.when(mockContext.response()).thenReturn(mockResponse);
-    Mockito.when(mockResponse.bytesWritten()).thenReturn(bytesWritten);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("0", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/TraceIdItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/TraceIdItemTest.java
deleted file mode 100644
index fce9e96..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/TraceIdItemTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.hamcrest.core.Is.is;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.servicecomb.common.rest.RestConst;
-import org.apache.servicecomb.core.Const;
-import org.apache.servicecomb.core.Invocation;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.ext.web.RoutingContext;
-
-public class TraceIdItemTest {
-  private static final TraceIdItem ELEMENT = new TraceIdItem();
-
-  @Test
-  public void testGetFormattedElementFromInvocationContext() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-    Map<String, Object> data = new HashMap<>();
-    Invocation invocation = Mockito.mock(Invocation.class);
-    String traceIdTest = "traceIdTest";
-
-    Mockito.when(invocation.getContext(Const.TRACE_ID_NAME)).thenReturn(traceIdTest);
-    Mockito.when(routingContext.data()).thenReturn(data);
-    data.put(RestConst.REST_INVOCATION_CONTEXT, invocation);
-
-    param.setContextData(routingContext);
-
-    String result = ELEMENT.getFormattedItem(param);
-    Assert.assertThat(result, is(traceIdTest));
-  }
-
-  @Test
-  public void testGetFormattedElementFromRequestHeader() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-    Map<String, Object> data = new HashMap<>();
-    Invocation invocation = Mockito.mock(Invocation.class);
-    String traceIdTest = "traceIdTest";
-
-    Mockito.when(invocation.getContext(Const.TRACE_ID_NAME)).thenReturn(null);
-    Mockito.when(routingContext.data()).thenReturn(data);
-    data.put(RestConst.REST_INVOCATION_CONTEXT, invocation);
-
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    Mockito.when(request.getHeader(Const.TRACE_ID_NAME)).thenReturn(traceIdTest);
-    Mockito.when(routingContext.request()).thenReturn(request);
-
-    param.setContextData(routingContext);
-
-    String result = ELEMENT.getFormattedItem(param);
-    Assert.assertThat(result, is(traceIdTest));
-  }
-
-  @Test
-  public void testGetFormattedElementOnTraceIdNotFound() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-    Map<String, Object> data = new HashMap<>();
-    Invocation invocation = Mockito.mock(Invocation.class);
-
-    Mockito.when(invocation.getContext(Const.TRACE_ID_NAME)).thenReturn("");
-    Mockito.when(routingContext.data()).thenReturn(data);
-    data.put(RestConst.REST_INVOCATION_CONTEXT, invocation);
-
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    Mockito.when(request.getHeader(Const.TRACE_ID_NAME)).thenReturn(null);
-    Mockito.when(routingContext.request()).thenReturn(request);
-
-    param.setContextData(routingContext);
-
-    String result = ELEMENT.getFormattedItem(param);
-    Assert.assertThat(result, is("-"));
-
-    Mockito.when(invocation.getContext(Const.TRACE_ID_NAME)).thenReturn(null);
-    result = ELEMENT.getFormattedItem(param);
-    Assert.assertThat(result, is("-"));
-  }
-
-  @Test
-  public void testGetFormattedElementOnInvocationContextIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-    Map<String, Object> data = new HashMap<>();
-
-    Mockito.when(routingContext.data()).thenReturn(data);
-
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    Mockito.when(request.getHeader(Const.TRACE_ID_NAME)).thenReturn(null);
-    Mockito.when(routingContext.request()).thenReturn(request);
-
-    param.setContextData(routingContext);
-
-    String result = ELEMENT.getFormattedItem(param);
-    Assert.assertThat(result, is("-"));
-  }
-
-  @Test
-  public void testGetFormattedElementOnDataIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    Mockito.when(request.getHeader(Const.TRACE_ID_NAME)).thenReturn(null);
-    Mockito.when(routingContext.request()).thenReturn(request);
-
-    param.setContextData(routingContext);
-    Mockito.when(routingContext.data()).thenReturn(null);
-
-    String result = ELEMENT.getFormattedItem(param);
-    Assert.assertThat(result, is("-"));
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UrlPathItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UrlPathItemTest.java
deleted file mode 100644
index ee200bc..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UrlPathItemTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.ext.web.RoutingContext;
-
-public class UrlPathItemTest {
-
-  @Test
-  public void getFormattedElement() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    String uri = "/uri/test";
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.path()).thenReturn(uri);
-
-    String result = new UrlPathItem().getFormattedItem(param);
-
-    Assert.assertEquals(uri, result);
-  }
-
-  @Test
-  public void getFormattedElementOnRequestIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(null);
-
-    String result = new UrlPathItem().getFormattedItem(param);
-
-    Assert.assertEquals("-", result);
-  }
-
-  @Test
-  public void getFormattedElementOnMethodIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.path()).thenReturn(null);
-
-    String result = new UrlPathItem().getFormattedItem(param);
-
-    Assert.assertEquals("-", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UrlPathWithQueryItemTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UrlPathWithQueryItemTest.java
deleted file mode 100644
index 11710e4..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UrlPathWithQueryItemTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.ext.web.RoutingContext;
-
-public class UrlPathWithQueryItemTest {
-
-  public static final UrlPathWithQueryItem ELEMENT = new UrlPathWithQueryItem();
-
-  @Test
-  public void getFormattedElement() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    String uri = "uriTest";
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.uri()).thenReturn(uri);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals(uri, result);
-  }
-
-
-  @Test
-  public void getFormattedElementOnRequestIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(null);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-
-  @Test
-  public void getFormattedElementOnUriIsNull() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.uri()).thenReturn(null);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-
-
-  @Test
-  public void getFormattedElementOnUriIsEmpty() {
-    AccessLogParam<RoutingContext> param = new AccessLogParam<>();
-    RoutingContext context = Mockito.mock(RoutingContext.class);
-    HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
-    String uri = "";
-
-    param.setContextData(context);
-    Mockito.when(context.request()).thenReturn(request);
-    Mockito.when(request.uri()).thenReturn(uri);
-
-    String result = ELEMENT.getFormattedItem(param);
-
-    assertEquals("-", result);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UserDefinedAccessLogItemLowPriority.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UserDefinedAccessLogItemLowPriority.java
deleted file mode 100644
index eec7b29..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/UserDefinedAccessLogItemLowPriority.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-
-import io.vertx.ext.web.RoutingContext;
-
-/**
- * For access log extension test, will be overridden by {@link RemoteHostItem}("%h"),
- * and takes no effect.
- */
-public class UserDefinedAccessLogItemLowPriority implements AccessLogItem<RoutingContext> {
-
-  @Override
-  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
-    return "OverriddenItem";
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/impl/AccessLogHandlerTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/impl/AccessLogHandlerTest.java
deleted file mode 100644
index 2dcd099..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/impl/AccessLogHandlerTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.impl;
-
-import java.util.HashMap;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.log4j.Level;
-import org.apache.servicecomb.foundation.common.Holder;
-import org.apache.servicecomb.foundation.test.scaffolding.log.LogCollector;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.vertx.core.Handler;
-import io.vertx.core.http.Cookie;
-import io.vertx.core.http.HttpServerRequest;
-import io.vertx.core.http.HttpServerResponse;
-import io.vertx.core.net.SocketAddress;
-import io.vertx.ext.web.RoutingContext;
-import mockit.Mock;
-import mockit.MockUp;
-
-public class AccessLogHandlerTest {
-  private static final AccessLogHandler ACCESS_LOG_HANDLER = new AccessLogHandler(
-      "%h - - %s durationMillisecond=[%D] %{test-config}user-defined %{cookie-name}C %v");
-
-  private LogCollector logCollector;
-
-  @Before
-  public void setUp() {
-    logCollector = new LogCollector();
-    logCollector.setLogLevel("accesslog", Level.INFO);
-  }
-
-  @After
-  public void tearDown() {
-    logCollector.teardown();
-  }
-
-  @Test
-  public void testHandle() {
-    RoutingContext routingContext = Mockito.mock(RoutingContext.class);
-    HashMap<String, Cookie> cookies = new HashMap<>();
-    Cookie cookie = Mockito.mock(Cookie.class);
-    HttpServerResponse httpServerResponse = new MockUp<HttpServerResponse>() {
-      @Mock
-      public HttpServerResponse endHandler(Handler<Void> handler) {
-        handler.handle(null);
-        return null;
-      }
-
-      @Mock
-      public int getStatusCode() {
-        return 200;
-      }
-    }.getMockInstance();
-    HttpServerRequest httpServerRequest = Mockito.mock(HttpServerRequest.class);
-    SocketAddress remoteSocketAddress = Mockito.mock(SocketAddress.class);
-    SocketAddress localSocketAddress = Mockito.mock(SocketAddress.class);
-
-    Holder<Integer> counter = new Holder<>();
-    counter.value = 0;
-    String testThreadName = Thread.currentThread().getName();
-    new MockUp<System>() {
-      @Mock
-      long currentTimeMillis() {
-        if (!testThreadName.equals(Thread.currentThread().getName())) {
-          return TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
-        }
-        if (counter.value < 1) {
-          ++counter.value;
-          return 1L;
-        }
-        return 123L;
-      }
-    };
-    cookies.put(cookie.getName(), cookie);
-    Mockito.when(cookie.getName()).thenReturn("cookie-name");
-    Mockito.when(cookie.getValue()).thenReturn("cookie-value");
-    Mockito.when(routingContext.cookieMap()).thenReturn(cookies);
-    Mockito.when(routingContext.response()).thenReturn(httpServerResponse);
-    Mockito.when(routingContext.request()).thenReturn(httpServerRequest);
-    Mockito.when(httpServerRequest.remoteAddress()).thenReturn(remoteSocketAddress);
-    Mockito.when(remoteSocketAddress.host()).thenReturn("192.168.0.22");
-    Mockito.when(httpServerRequest.localAddress()).thenReturn(localSocketAddress);
-    Mockito.when(localSocketAddress.host()).thenReturn("192.168.0.33");
-    ACCESS_LOG_HANDLER.handle(routingContext);
-
-    Assert.assertEquals(
-        "192.168.0.22 - - 200 durationMillisecond=[122] user-defined-test-config cookie-value 192.168.0.33",
-        logCollector.getEvents().get(0).getMessage());
-  }
-}
\ No newline at end of file
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/TestCompositeExtendedAccessLogItemMeta.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/TestCompositeExtendedAccessLogItemMeta.java
deleted file mode 100644
index c226bab..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/TestCompositeExtendedAccessLogItemMeta.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.parser.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.UserDefinedAccessLogItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.CompositeVertxRestAccessLogItemMeta;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.VertxRestAccessLogItemMeta;
-
-public class TestCompositeExtendedAccessLogItemMeta extends CompositeVertxRestAccessLogItemMeta {
-  private static final List<VertxRestAccessLogItemMeta> META_LIST = new ArrayList<>();
-
-  static {
-    META_LIST.add(new VertxRestAccessLogItemMeta("%{", "}user-defined", UserDefinedAccessLogItem::new));
-  }
-
-  @Override
-  public List<VertxRestAccessLogItemMeta> getAccessLogItemMetas() {
-    return META_LIST;
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/TestSingleExtendedAccessLogItemMeta.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/TestSingleExtendedAccessLogItemMeta.java
deleted file mode 100644
index 9a2a1c7..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/TestSingleExtendedAccessLogItemMeta.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.parser.impl;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.UserDefinedAccessLogItemLowPriority;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.VertxRestAccessLogItemMeta;
-
-public class TestSingleExtendedAccessLogItemMeta extends VertxRestAccessLogItemMeta {
-  public TestSingleExtendedAccessLogItemMeta() {
-    super("%h", null, config -> new UserDefinedAccessLogItemLowPriority(), 1);
-  }
-}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/VertxRestAccessLogPatternParserTest.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/VertxRestAccessLogPatternParserTest.java
deleted file mode 100644
index cf31d15..0000000
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/VertxRestAccessLogPatternParserTest.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.transport.rest.vertx.accesslog.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Locale;
-import java.util.TimeZone;
-
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.CookieItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.DatetimeConfigurableItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.DurationMillisecondItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.DurationSecondItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.FirstLineOfRequestItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.HttpMethodItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.HttpStatusItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.InvocationContextItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.LocalHostItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.LocalPortItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.QueryStringItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.RemoteHostItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.RequestHeaderItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.RequestProtocolItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.ResponseHeaderItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.ResponseSizeItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.TraceIdItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.UrlPathItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.element.impl.UrlPathWithQueryItem;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.CompositeVertxRestAccessLogItemMeta;
-import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.VertxRestAccessLogItemMeta;
-import org.junit.Assert;
-import org.junit.Test;
-
-import io.vertx.ext.web.RoutingContext;
-import mockit.Deencapsulation;
-import mockit.Mock;
-import mockit.MockUp;
-
-public class VertxRestAccessLogPatternParserTest {
-  private static final String ROW_PATTERN = "[cs-method] %m %s%T%D%h%v%p%B%b%r%U%q"
-      + "cs-uri-stemcs-uri-querycs-uri%H%t%{yyyy MM dd HH:mm:ss zzz}t"
-      + "%{yyyy MM dd HH:mm:ss|GMT+0|en-US}t"
-      + "%{incoming-header}i"
-      + "%{outgoing-header}o"
-      + "%{cookie}C"
-      + "%SCB-traceId"
-      + "%{ctx}SCB-ctx";
-
-  private static VertxRestAccessLogPatternParser accessLogPatternParser = new VertxRestAccessLogPatternParser();
-
-  @Test
-  public void testParsePatternFullTest() {
-    List<AccessLogItem<RoutingContext>> result = accessLogPatternParser.parsePattern(ROW_PATTERN);
-    assertEquals(28, result.size());
-
-    assertEquals("[", result.get(0).getFormattedItem(null));
-    assertEquals(HttpMethodItem.class, result.get(1).getClass());
-    assertEquals("] ", result.get(2).getFormattedItem(null));
-    assertEquals(HttpMethodItem.class, result.get(3).getClass());
-    assertEquals(" ", result.get(4).getFormattedItem(null));
-    assertEquals(HttpStatusItem.class, result.get(5).getClass());
-    assertEquals(DurationSecondItem.class, result.get(6).getClass());
-    assertEquals(DurationMillisecondItem.class, result.get(7).getClass());
-    assertEquals(RemoteHostItem.class, result.get(8).getClass());
-    assertEquals(LocalHostItem.class, result.get(9).getClass());
-    assertEquals(LocalPortItem.class, result.get(10).getClass());
-    assertEquals(ResponseSizeItem.class, result.get(11).getClass());
-    assertEquals("0", ((ResponseSizeItem) result.get(11)).getZeroBytes());
-    assertEquals(ResponseSizeItem.class, result.get(12).getClass());
-    assertEquals("-", ((ResponseSizeItem) result.get(12)).getZeroBytes());
-    assertEquals(FirstLineOfRequestItem.class, result.get(13).getClass());
-    assertEquals(UrlPathItem.class, result.get(14).getClass());
-    assertEquals(QueryStringItem.class, result.get(15).getClass());
-    assertEquals(UrlPathItem.class, result.get(16).getClass());
-    assertEquals(QueryStringItem.class, result.get(17).getClass());
-    assertEquals(UrlPathWithQueryItem.class, result.get(18).getClass());
-    assertEquals(RequestProtocolItem.class, result.get(19).getClass());
-    assertEquals(DatetimeConfigurableItem.class, result.get(20).getClass());
-    assertEquals(DatetimeConfigurableItem.DEFAULT_DATETIME_PATTERN,
-        ((DatetimeConfigurableItem) result.get(20)).getPattern());
-    assertEquals(DatetimeConfigurableItem.DEFAULT_LOCALE, ((DatetimeConfigurableItem) result.get(20)).getLocale());
-    assertEquals(TimeZone.getDefault(), ((DatetimeConfigurableItem) result.get(20)).getTimezone());
-    assertEquals("yyyy MM dd HH:mm:ss zzz", ((DatetimeConfigurableItem) result.get(21)).getPattern());
-    assertEquals(DatetimeConfigurableItem.DEFAULT_LOCALE, ((DatetimeConfigurableItem) result.get(21)).getLocale());
-    assertEquals(TimeZone.getDefault(), ((DatetimeConfigurableItem) result.get(21)).getTimezone());
-    assertEquals("yyyy MM dd HH:mm:ss", ((DatetimeConfigurableItem) result.get(22)).getPattern());
-    assertEquals(Locale.forLanguageTag("en-US"), ((DatetimeConfigurableItem) result.get(22)).getLocale());
-    assertEquals(TimeZone.getTimeZone("GMT+0"), ((DatetimeConfigurableItem) result.get(22)).getTimezone());
-    assertEquals(RequestHeaderItem.class, result.get(23).getClass());
-    assertEquals("incoming-header", ((RequestHeaderItem) result.get(23)).getVarName());
-    assertEquals(ResponseHeaderItem.class, result.get(24).getClass());
-    assertEquals("outgoing-header", ((ResponseHeaderItem) result.get(24)).getVarName());
-    assertEquals(CookieItem.class, result.get(25).getClass());
-    assertEquals("cookie", ((CookieItem) result.get(25)).getVarName());
-    assertEquals(TraceIdItem.class, result.get(26).getClass());
-    assertEquals(InvocationContextItem.class, result.get(27).getClass());
-    assertEquals("ctx", ((InvocationContextItem) result.get(27)).getVarName());
-  }
-
-  @Test
-  public void testParsePattern() {
-    String pattern = " %m  cs-uri-stem %{response-header}o ";
-    List<AccessLogItem<RoutingContext>> result = accessLogPatternParser.parsePattern(pattern);
-    assertEquals(7, result.size());
-
-    assertEquals(" ", result.get(0).getFormattedItem(null));
-    assertEquals(HttpMethodItem.class, result.get(1).getClass());
-    assertEquals("  ", result.get(2).getFormattedItem(null));
-    assertEquals(UrlPathItem.class, result.get(3).getClass());
-    assertEquals(" ", result.get(4).getFormattedItem(null));
-    assertEquals(ResponseHeaderItem.class, result.get(5).getClass());
-    assertEquals("response-header", ((ResponseHeaderItem) result.get(5)).getVarName());
-    assertEquals(" ", result.get(6).getFormattedItem(null));
-  }
-
-  @Test
-  public void testParsePatternWithNoBlank() {
-    String pattern = "%mcs-uri-stem%{response-header}o";
-    List<AccessLogItem<RoutingContext>> result = accessLogPatternParser.parsePattern(pattern);
-    assertEquals(3, result.size());
-
-    assertEquals(HttpMethodItem.class, result.get(0).getClass());
-    assertEquals(UrlPathItem.class, result.get(1).getClass());
-    assertEquals(ResponseHeaderItem.class, result.get(2).getClass());
-    assertEquals("response-header", ((ResponseHeaderItem) result.get(2)).getVarName());
-  }
-
-  @Test
-  public void testParsePatternComplex() {
-    String pattern = "%m  cs-uri-stem %{response-header}o abc cs-uri-query %s%{request} header}i plain cs-uri";
-    List<AccessLogItem<RoutingContext>> result = accessLogPatternParser.parsePattern(pattern);
-    assertEquals(12, result.size());
-
-    assertEquals(HttpMethodItem.class, result.get(0).getClass());
-    assertEquals("  ", result.get(1).getFormattedItem(null));
-    assertEquals(UrlPathItem.class, result.get(2).getClass());
-    assertEquals(" ", result.get(3).getFormattedItem(null));
-    assertEquals(ResponseHeaderItem.class, result.get(4).getClass());
-    assertEquals("response-header", ((ResponseHeaderItem) result.get(4)).getVarName());
-    assertEquals(" abc ", result.get(5).getFormattedItem(null));
-    assertEquals(QueryStringItem.class, result.get(6).getClass());
-    assertEquals(" ", result.get(7).getFormattedItem(null));
-    assertEquals(HttpStatusItem.class, result.get(8).getClass());
-    assertEquals(RequestHeaderItem.class, result.get(9).getClass());
-    assertEquals("request} header", ((RequestHeaderItem) result.get(9)).getVarName());
-    assertEquals(" plain ", result.get(10).getFormattedItem(null));
-    assertEquals(UrlPathWithQueryItem.class, result.get(11).getClass());
-  }
-
-  Comparator<VertxRestAccessLogItemMeta> comparator = VertxRestAccessLogPatternParser.accessLogItemMetaComparator;
-
-  /**
-   * one factor test
-   */
-  @Test
-  public void testCompareMetaSimple() {
-    Assert.assertTrue(
-        comparator.compare(
-            new VertxRestAccessLogItemMeta(null, null, null, 0),
-            new VertxRestAccessLogItemMeta(null, null, null, 1)
-        ) < 0
-    );
-    Assert.assertTrue(
-        comparator.compare(
-            new VertxRestAccessLogItemMeta(null, "}abc", null, 0),
-            new VertxRestAccessLogItemMeta(null, null, null, 0)
-        ) < 0
-    );
-    Assert.assertTrue(
-        comparator.compare(
-            new VertxRestAccessLogItemMeta(null, "}abc", null, 0),
-            new VertxRestAccessLogItemMeta(null, "}de", null, 0)
-        ) < 0
-    );
-    Assert.assertTrue(
-        comparator.compare(
-            new VertxRestAccessLogItemMeta(null, "}abc", null, 0),
-            new VertxRestAccessLogItemMeta(null, "}ab", null, 0)
-        ) < 0
-    );
-    Assert.assertTrue(
-        comparator.compare(
-            new VertxRestAccessLogItemMeta("%abc", null, null, 0),
-            new VertxRestAccessLogItemMeta("%de", null, null, 0)
-        ) < 0
-    );
-    Assert.assertTrue(
-        comparator.compare(
-            new VertxRestAccessLogItemMeta("%abc", null, null, 0),
-            new VertxRestAccessLogItemMeta("%ab", null, null, 0)
-        ) < 0
-    );
-    Assert.assertEquals(0, comparator.compare(
-        new VertxRestAccessLogItemMeta("%abc", null, null, 0),
-        new VertxRestAccessLogItemMeta("%abc", null, null, 0)
-    ));
-  }
-
-  /**
-   * multiple factors test
-   */
-  @Test
-  public void testCompareMetaComplex() {
-    Assert.assertTrue(
-        comparator.compare(
-            new VertxRestAccessLogItemMeta("%bcd", "}ab", null, 0),
-            new VertxRestAccessLogItemMeta("%abc", "}abc", null, 0)
-        ) > 0
-    );
-    Assert.assertTrue(
-        comparator.compare(
-            new VertxRestAccessLogItemMeta("%abc", null, null, 0),
-            new VertxRestAccessLogItemMeta("%bcd", "}ab", null, 0)
-        ) > 0
-    );
-    Assert.assertTrue(
-        comparator.compare(
-            new VertxRestAccessLogItemMeta("%bcd", "}abc", null, 0),
-            new VertxRestAccessLogItemMeta("%abc", "}abc", null, 0)
-        ) > 0
-    );
-    Assert.assertTrue(
-        comparator.compare(
-            new VertxRestAccessLogItemMeta("%abc", "}abc", null, 1),
-            new VertxRestAccessLogItemMeta("%ab", "}ab", null, 0)
-        ) > 0
-    );
-  }
-
-  @Test
-  public void testComparePlaceholderString() {
-    Assert.assertTrue(
-        VertxRestAccessLogPatternParser.comparePlaceholderString("abc", "bbc") < 0
-    );
-    Assert.assertTrue(
-        VertxRestAccessLogPatternParser.comparePlaceholderString("abc", "ab") < 0
-    );
-    Assert.assertEquals(0, VertxRestAccessLogPatternParser.comparePlaceholderString("abc", "abc"));
-    Assert.assertTrue(
-        VertxRestAccessLogPatternParser.comparePlaceholderString("bbc", "abc") > 0
-    );
-    Assert.assertTrue(
-        VertxRestAccessLogPatternParser.comparePlaceholderString("ab", "abc") > 0
-    );
-  }
-
-  @Test
-  public void testExtendedVertxRestAccessLogItemCreator() {
-    final List<VertxRestAccessLogItemMeta> metaList0 = new ArrayList<>();
-    metaList0.add(new VertxRestAccessLogItemMeta("%{", "}abc", null));
-    metaList0.add(new VertxRestAccessLogItemMeta("%{", "}a", null));
-    metaList0.add(new VertxRestAccessLogItemMeta("%_", null, null, -1));
-
-    final List<VertxRestAccessLogItemMeta> metaList1 = new ArrayList<>();
-    metaList0.add(new VertxRestAccessLogItemMeta("%a", "}abc", null));
-    metaList0.add(new VertxRestAccessLogItemMeta("%0", "}abc", null, 1));
-    metaList0.add(new VertxRestAccessLogItemMeta("%m", null, null));
-
-    new MockUp<VertxRestAccessLogPatternParser>() {
-      @Mock
-      List<VertxRestAccessLogItemMeta> loadVertxRestAccessLogItemMeta() {
-        List<VertxRestAccessLogItemMeta> metaList = new ArrayList<>(1);
-        CompositeVertxRestAccessLogItemMeta compositeMeta0 = new CompositeVertxRestAccessLogItemMeta() {
-          @Override
-          public List<VertxRestAccessLogItemMeta> getAccessLogItemMetas() {
-            return metaList0;
-          }
-        };
-        CompositeVertxRestAccessLogItemMeta compositeMeta1 = new CompositeVertxRestAccessLogItemMeta() {
-          @Override
-          public List<VertxRestAccessLogItemMeta> getAccessLogItemMetas() {
-            return metaList1;
-          }
-        };
-        metaList.add(compositeMeta0);
-        metaList.add(compositeMeta1);
-        metaList.add(new VertxRestAccessLogItemMeta("%{", null, null));
-        return metaList;
-      }
-    };
-
-    VertxRestAccessLogPatternParser parser = new VertxRestAccessLogPatternParser();
-
-    List<VertxRestAccessLogItemMeta> accessLogItemMetaList =
-        Deencapsulation.getField(parser, "metaList");
-
-    assertEquals(7, accessLogItemMetaList.size());
-    assertEquals("%_", accessLogItemMetaList.get(0).getPrefix());
-    assertEquals("%a", accessLogItemMetaList.get(1).getPrefix());
-    assertEquals("}abc", accessLogItemMetaList.get(1).getSuffix());
-    assertEquals("%{", accessLogItemMetaList.get(2).getPrefix());
-    assertEquals("}abc", accessLogItemMetaList.get(2).getSuffix());
-    assertEquals("%{", accessLogItemMetaList.get(3).getPrefix());
-    assertEquals("}a", accessLogItemMetaList.get(3).getSuffix());
-    assertEquals("%m", accessLogItemMetaList.get(4).getPrefix());
-    assertNull(accessLogItemMetaList.get(4).getSuffix());
-    assertEquals("%{", accessLogItemMetaList.get(5).getPrefix());
-    assertNull(accessLogItemMetaList.get(5).getSuffix());
-    assertEquals("%0", accessLogItemMetaList.get(6).getPrefix());
-    assertEquals("}abc", accessLogItemMetaList.get(6).getSuffix());
-  }
-}