From 00bc525d8e8b13484a7d36a64462137025c3f024 Mon Sep 17 00:00:00 2001 From: zhouzb Date: Wed, 22 Jul 2020 11:03:46 +0800 Subject: [PATCH] refactor(add-log): log when subscription fails --- src/emqx_channel.erl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/emqx_channel.erl b/src/emqx_channel.erl index 184bfa2fc..9bf13b3f2 100644 --- a/src/emqx_channel.erl +++ b/src/emqx_channel.erl @@ -540,6 +540,7 @@ process_subscribe([{TopicFilter, SubOpts}|More], SubProps, Channel, Acc) -> {RC, NChannel} = do_subscribe(TopicFilter, SubOpts#{sub_props => SubProps}, Channel), process_subscribe(More, SubProps, NChannel, [RC|Acc]); {error, RC} -> + ?LOG(warning, "Cannot subscribe ~s due to ~s.", [TopicFilter, emqx_reason_codes:text(RC)]), process_subscribe(More, SubProps, Channel, [RC|Acc]) end. @@ -552,6 +553,7 @@ do_subscribe(TopicFilter, SubOpts = #{qos := QoS}, Channel = {ok, NSession} -> {QoS, Channel#channel{session = NSession}}; {error, RC} -> + ?LOG(warning, "Cannot subscribe ~s due to ~s.", [TopicFilter, emqx_reason_codes:text(RC)]), {RC, Channel} end.