apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.5k stars 26.43k forks source link

The judgment condition for the AccessLogFilter print log is incorrect. #4933

Closed wangyanrui closed 5 years ago

wangyanrui commented 5 years ago

Environment

Steps to reproduce this issue

  1. open AccessLogFilter
    dubbo:
    scan:
    base-packages: ...
    protocol:
    name: dubbo
    port: 12345
    registry:
    address: N/A
    provider:
    accesslog: true
  2. org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper#buildInvokerChain return the AccessLogFilter success
  3. org.apache.dubbo.rpc.filter.AccessLogFilter#invoke
    String accessLogKey = invoker.getUrl().getParameter(ACCESS_LOG_KEY);
    if (ConfigUtils.isNotEmpty(accessLogKey)) {
    log......
    }

    invoker.getUrl() not contain parameter who's named 'ACCESS_LOG_KEY' but accesslog. private static final String ACCESS_LOG_KEY = "dubbo.accesslog"; (Line 71 in AccessLogFilter) There is no way to successfully print the log.

image

wangyanrui commented 5 years ago

It is possible that the way to generate the URL is wrong or or simply the match string mistake, or is it that I am using it incorrectly?

wangyanrui commented 5 years ago

Sorry, It's happened when use dubbo-spring-boot-starter and normal when use xml. I have already raised this question in the corresponding project, need to close it here?

CrazyHZM commented 5 years ago

It has been fixed

wangyanrui commented 5 years ago

Can you tell me when and what version fixes it? tks,tks

CrazyHZM commented 5 years ago

The next version will be fixed, the specific time has not been determined, if it is urgent, you can refer to this part of the change #4566

wangyanrui commented 5 years ago

The judgment condition is "accesslog", but the matching content is still "dubbo.accesslog" in the fixed. Are you sure that this problem is fixed? Or is it wrong with me???

CrazyHZM commented 5 years ago

‘dubbo.accesslog’ and ‘ accesslog’ have different meanings, you can refer to this article: http://dubbo.apache.org/en-us/docs/user/demos/accesslog.html

wangyanrui commented 5 years ago

The parameters in the URL are "accesslog=true" Whether to print the log is based on whether the URL contains the "dubbo.accesslog" parameter image

It's always false, Maybe we are not talking about one thing!!

CrazyHZM commented 5 years ago

You can update your code and see the latest code on the master. see org.apache.dubbo.rpc.Constants.ACCESS_LOG_KEY

wangyanrui commented 5 years ago

What you are saying is whether to open this filter and I am saying whether to print the log = =

image image

CrazyHZM commented 5 years ago

This is the latest code, if you still have questions, you can add my contact WeChat:15869687598 private static final String LOG_KEY = "dubbo.accesslog";