2525import com .datastax .oss .driver .internal .core .channel .DriverChannel .RequestMessage ;
2626import com .datastax .oss .driver .internal .core .channel .DriverChannel .SetKeyspaceEvent ;
2727import com .datastax .oss .driver .internal .core .protocol .FrameDecodingException ;
28+ import com .datastax .oss .driver .internal .core .util .Loggers ;
2829import com .datastax .oss .protocol .internal .Frame ;
2930import com .datastax .oss .protocol .internal .Message ;
3031import com .datastax .oss .protocol .internal .request .Query ;
@@ -213,7 +214,8 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
213214 try {
214215 eventCallback .onEvent (event );
215216 } catch (Throwable t ) {
216- LOG .warn ("[{}] Unexpected error while invoking event handler" , logPrefix , t );
217+ Loggers .warnWithException (
218+ LOG , "[{}] Unexpected error while invoking event handler" , logPrefix , t );
217219 }
218220 }
219221 } else {
@@ -234,7 +236,8 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
234236 try {
235237 responseCallback .onResponse (responseFrame );
236238 } catch (Throwable t ) {
237- LOG .warn ("[{}] Unexpected error while invoking response handler" , logPrefix , t );
239+ Loggers .warnWithException (
240+ LOG , "[{}] Unexpected error while invoking response handler" , logPrefix , t );
238241 }
239242 }
240243 }
@@ -252,10 +255,12 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable exception) thro
252255 try {
253256 responseCallback .onFailure (exception .getCause ());
254257 } catch (Throwable t ) {
255- LOG .warn ("[{}] Unexpected error while invoking failure handler" , logPrefix , t );
258+ Loggers .warnWithException (
259+ LOG , "[{}] Unexpected error while invoking failure handler" , logPrefix , t );
256260 }
257261 } else {
258- LOG .warn (
262+ Loggers .warnWithException (
263+ LOG ,
259264 "[{}] Unexpected error while decoding incoming event frame" ,
260265 logPrefix ,
261266 exception .getCause ());
@@ -384,7 +389,8 @@ void fail(String message, Throwable cause) {
384389 // keyspace switch fails, this could be due to a schema disagreement or a more serious
385390 // error. Rescheduling the switch is impractical, we can't do much better than closing the
386391 // channel and letting it reconnect.
387- LOG .warn ("[{}] Unexpected error while switching keyspace" , logPrefix , setKeyspaceException );
392+ Loggers .warnWithException (
393+ LOG , "[{}] Unexpected error while switching keyspace" , logPrefix , setKeyspaceException );
388394 abortAllInFlight (setKeyspaceException , this );
389395 ctx .channel ().close ();
390396 }
0 commit comments