@@ -175,12 +175,12 @@ private Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, fin
175175 try {
176176 is .close ();
177177 } catch (final IOException e ) {
178- logger .warn ("Exception when closing , console proxy address : " + proxyManagementIp );
178+ logger .warn ("Exception when closing , console proxy address : {}" , proxyManagementIp );
179179 success = false ;
180180 }
181181 }
182182 } catch (final IOException e ) {
183- logger .warn ("Unable to open console proxy command port url, console proxy address : " + proxyManagementIp );
183+ logger .warn ("Unable to open console proxy command port url, console proxy address : {}" , proxyManagementIp );
184184 success = false ;
185185 }
186186
@@ -278,34 +278,33 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
278278 disableRpFilter ();
279279 }
280280
281- if (logger .isInfoEnabled ())
282- logger .info ("Receive proxyVmId in ConsoleProxyResource configuration as " + proxyVmId );
281+ logger .info ("Receive proxyVmId in ConsoleProxyResource configuration as {}" , proxyVmId );
283282
284283 return true ;
285284 }
286285
287286 private void addRouteToInternalIpOrCidr (String localgw , String eth1ip , String eth1mask , String destIpOrCidr ) {
288- logger .debug ("addRouteToInternalIp: localgw=" + localgw + " , eth1ip=" + eth1ip + " , eth1mask=" + eth1mask + ", destIp=" + destIpOrCidr );
287+ logger .debug ("addRouteToInternalIp: localgw={} , eth1ip={} , eth1mask={}, destIp={}" , localgw , eth1ip , eth1mask , destIpOrCidr );
289288 if (destIpOrCidr == null ) {
290289 logger .debug ("addRouteToInternalIp: destIp is null" );
291290 return ;
292291 }
293292 if (!NetUtils .isValidIp4 (destIpOrCidr ) && !NetUtils .isValidIp4Cidr (destIpOrCidr )) {
294- logger .warn (" destIp is not a valid ip address or cidr destIp=" + destIpOrCidr );
293+ logger .warn (" destIp is not a valid ip address or cidr destIp={}" , destIpOrCidr );
295294 return ;
296295 }
297296 boolean inSameSubnet = false ;
298297 if (NetUtils .isValidIp4 (destIpOrCidr )) {
299298 if (eth1ip != null && eth1mask != null ) {
300299 inSameSubnet = NetUtils .sameSubnet (eth1ip , destIpOrCidr , eth1mask );
301300 } else {
302- logger .warn ("addRouteToInternalIp: unable to determine same subnet: eth1ip=" + eth1ip + " , dest ip=" + destIpOrCidr + " , eth1mask=" + eth1mask );
301+ logger .warn ("addRouteToInternalIp: unable to determine same subnet: eth1ip={} , dest ip={} , eth1mask={}" , eth1ip , destIpOrCidr , eth1mask );
303302 }
304303 } else {
305304 inSameSubnet = NetUtils .isNetworkAWithinNetworkB (destIpOrCidr , NetUtils .ipAndNetMaskToCidr (eth1ip , eth1mask ));
306305 }
307306 if (inSameSubnet ) {
308- logger .debug ("addRouteToInternalIp: dest ip " + destIpOrCidr + " is in the same subnet as eth1 ip " + eth1ip );
307+ logger .debug ("addRouteToInternalIp: dest ip {} is in the same subnet as eth1 ip {}" , destIpOrCidr , eth1ip );
309308 return ;
310309 }
311310 Script command = new Script ("/bin/bash" , logger );
@@ -317,9 +316,9 @@ private void addRouteToInternalIpOrCidr(String localgw, String eth1ip, String et
317316 command .add ("ip route add " + destIpOrCidr + " via " + localgw );
318317 String result = command .execute ();
319318 if (result != null ) {
320- logger .warn ("Error in configuring route to internal ip err=" + result );
319+ logger .warn ("Error in configuring route to internal ip err={}" , result );
321320 } else {
322- logger .debug ("addRouteToInternalIp: added route to internal ip=" + destIpOrCidr + " via " + localgw );
321+ logger .debug ("addRouteToInternalIp: added route to internal ip={} via {}" , destIpOrCidr , localgw );
323322 }
324323 }
325324
@@ -332,7 +331,7 @@ private void launchConsoleProxy(final byte[] ksBits, final String ksPassword, fi
332331 final Object resource = this ;
333332 logger .info ("Building class loader for com.cloud.consoleproxy.ConsoleProxy" );
334333 if (consoleProxyMain == null ) {
335- logger .info ("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password=" + encryptorPassword );
334+ logger .info ("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password={}" , encryptorPassword );
336335 consoleProxyMain = new Thread (new ManagedContextRunnable () {
337336 @ Override
338337 protected void runInContext () {
@@ -355,7 +354,7 @@ protected void runInContext() {
355354 logger .error ("Unable to launch console proxy due to IllegalAccessException" , e );
356355 System .exit (ExitStatus .Error .value ());
357356 } catch (InvocationTargetException e ) {
358- logger .error ("Unable to launch console proxy due to InvocationTargetException " + e .getTargetException ().toString (), e );
357+ logger .error ("Unable to launch console proxy due to InvocationTargetException {}" , e .getTargetException ().toString (), e );
359358 System .exit (ExitStatus .Error .value ());
360359 }
361360 } catch (final ClassNotFoundException e ) {
@@ -418,10 +417,10 @@ public String authenticateConsoleAccess(String host, String port, String vmId, S
418417 result .setTunnelUrl (authAnswer .getTunnelUrl ());
419418 result .setTunnelSession (authAnswer .getTunnelSession ());
420419 } else {
421- logger .error ("Authentication failed for vm: " + vmId + " with sid: " + sid );
420+ logger .error ("Authentication failed for vm: {} with sid: {}" , vmId , sid );
422421 }
423422 } catch (AgentControlChannelException e ) {
424- logger .error ("Unable to send out console access authentication request due to " + e .getMessage (), e );
423+ logger .error ("Unable to send out console access authentication request due to {}" , e .getMessage (), e );
425424 }
426425
427426 return new Gson ().toJson (result );
@@ -431,26 +430,23 @@ public void reportLoadInfo(String gsonLoadInfo) {
431430 ConsoleProxyLoadReportCommand cmd = new ConsoleProxyLoadReportCommand (proxyVmId , gsonLoadInfo );
432431 try {
433432 getAgentControl ().postRequest (cmd );
434-
435- if (logger .isDebugEnabled ())
436- logger .debug ("Report proxy load info, proxy : " + proxyVmId + ", load: " + gsonLoadInfo );
433+ logger .debug ("Report proxy load info, proxy : {}, load: {}" , proxyVmId , gsonLoadInfo );
437434 } catch (AgentControlChannelException e ) {
438- logger .error ("Unable to send out load info due to " + e .getMessage (), e );
435+ logger .error ("Unable to send out load info due to {}" , e .getMessage (), e );
439436 }
440437 }
441438
442439 public void ensureRoute (String address ) {
443440 if (localGateway != null ) {
444- if (logger .isDebugEnabled ())
445- logger .debug ("Ensure route for " + address + " via " + localGateway );
441+ logger .debug ("Ensure route for {} via {}" , address , localGateway );
446442
447443 // this method won't be called in high frequency, serialize access
448444 // to script execution
449445 synchronized (this ) {
450446 try {
451447 addRouteToInternalIpOrCidr (localGateway , eth1Ip , eth1Mask , address );
452448 } catch (Throwable e ) {
453- logger .warn ("Unexpected exception while adding internal route to " + address , e );
449+ logger .warn ("Unexpected exception while adding internal route to {}" , address , e );
454450 }
455451 }
456452 }
0 commit comments