From 7000290bd79421faf6f56b538cdf91b7aeff1f82 Mon Sep 17 00:00:00 2001 From: catcherwong Date: Mon, 14 Jun 2021 00:24:12 +0800 Subject: [PATCH] log: add log for config rpc server request handler --- src/Nacos/V2/Config/Impl/ConfigRpcServerRequestHandler.cs | 7 +++++-- src/Nacos/V2/Config/Impl/ConfigRpcTransportClient.cs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Nacos/V2/Config/Impl/ConfigRpcServerRequestHandler.cs b/src/Nacos/V2/Config/Impl/ConfigRpcServerRequestHandler.cs index bd8ba4e..d605efc 100644 --- a/src/Nacos/V2/Config/Impl/ConfigRpcServerRequestHandler.cs +++ b/src/Nacos/V2/Config/Impl/ConfigRpcServerRequestHandler.cs @@ -1,5 +1,6 @@ namespace Nacos.V2.Config.Impl { + using Microsoft.Extensions.Logging; using Nacos.V2.Remote; using Nacos.V2.Remote.Requests; using Nacos.V2.Remote.Responses; @@ -10,11 +11,13 @@ public class ConfigRpcServerRequestHandler : IServerRequestHandler { + private readonly ILogger _logger; private ConcurrentDictionary _cacheMap; private Func _func; - public ConfigRpcServerRequestHandler(ConcurrentDictionary map, Func func) + public ConfigRpcServerRequestHandler(ILogger logger, ConcurrentDictionary map, Func func) { + this._logger = logger; this._cacheMap = map; this._func = func; } @@ -41,7 +44,7 @@ public CommonResponse RequestReply(CommonRequest request) _func.Invoke().Wait(); } - Console.WriteLine("Config RequestReply => {0}", request.ToJsonString()); + _logger?.LogDebug("Config RequestReply => {0}", request.ToJsonString()); return new ConfigChangeNotifyResponse(); } diff --git a/src/Nacos/V2/Config/Impl/ConfigRpcTransportClient.cs b/src/Nacos/V2/Config/Impl/ConfigRpcTransportClient.cs index e64a00c..e18f6d9 100644 --- a/src/Nacos/V2/Config/Impl/ConfigRpcTransportClient.cs +++ b/src/Nacos/V2/Config/Impl/ConfigRpcTransportClient.cs @@ -247,7 +247,7 @@ private ClientAbilities InitAbilities() private void InitHandlerRpcClient(RpcClient rpcClientInner) { - rpcClientInner.RegisterServerPushResponseHandler(new ConfigRpcServerRequestHandler(_cacheMap, NotifyListenConfig)); + rpcClientInner.RegisterServerPushResponseHandler(new ConfigRpcServerRequestHandler(_logger, _cacheMap, NotifyListenConfig)); rpcClientInner.RegisterConnectionListener(new ConfigRpcConnectionEventListener(_logger, rpcClientInner, _cacheMap, _listenExecutebell)); rpcClientInner.Init(new ConfigRpcServerListFactory(_serverListManager));