@@ -103,11 +103,11 @@ private void buildComputeEngineObject() throws IOException, GeneralSecurityExcep
103103 }
104104 } catch (GeneralSecurityException e ) {
105105 //Security exception occurred. Cant proceed further
106- log .fatal ("Could not authenticate and build compute object" );
106+ log .error ("Could not authenticate and build compute object" );
107107 throw new GeneralSecurityException (e );
108108 } catch (IOException e ) {
109109 //IO exception occurred. Cant proceed further
110- log .fatal ("Could not authenticate and build compute object" );
110+ log .error ("Could not authenticate and build compute object" );
111111 throw new IOException (e );
112112 }
113113 }
@@ -132,7 +132,7 @@ public static InstanceList getInstanceList(String zoneName, String filter) {
132132 return instanceList ;
133133 }
134134 } catch (IOException e ) {
135- log .warn ("Could not get instance list from GCE " , e );
135+ log .error ("Could not get instance list from GCE " , e );
136136 return null ;
137137 }
138138 }
@@ -215,7 +215,7 @@ private static HttpHealthCheckList getHealthCheckList() {
215215 return healthCheckList ;
216216 }
217217 } catch (IOException e ) {
218- log .warn ("Could not get health check list from GCE" , e );
218+ log .error ("Could not get health check list from GCE" , e );
219219 return null ;
220220 }
221221 }
@@ -248,11 +248,10 @@ public void createTargetPool(String targetPoolName, String healthCheckName) {
248248 Operation operation =
249249 compute .targetPools ().insert (PROJECT_ID , REGION_NAME , targetPool ).execute ();
250250 waitForRegionOperationCompletion (operation .getName ());
251-
251+ log . info ( "Target pool " + targetPoolName + " was created" );
252252 } catch (Exception e ) {
253- log .warn ("Could not create target pool: " + targetPoolName + " " + e );
253+ log .error ("Could not create target pool: " + targetPoolName , e );
254254 }
255- log .info ("Target pool " + targetPoolName + " was created" );
256255 }
257256
258257 /**
@@ -265,11 +264,10 @@ public void deleteTargetPool(String targetPoolName) {
265264 try {
266265 Operation operation = compute .targetPools ().delete (PROJECT_ID , REGION_NAME , targetPoolName ).execute ();
267266 waitForRegionOperationCompletion (operation .getName ());
268-
267+ log . info ( "Target pool: " + targetPoolName + " was deleted" );
269268 } catch (Exception e ) {
270- log .warn ("Could not delete target pool " + targetPoolName + " " + e );
269+ log .error ("Could not delete target pool " + targetPoolName , e );
271270 }
272- log .info ("Target pool: " + targetPoolName + " was deleted" );
273271 }
274272
275273 /**
@@ -295,10 +293,10 @@ public void createForwardingRule(String forwardingRuleName, String targetPoolNam
295293 try {
296294 Operation operation = compute .forwardingRules ().insert (PROJECT_ID , REGION_NAME , forwardingRule ).execute ();
297295 waitForRegionOperationCompletion (operation .getName ());
296+ log .info ("Forwarding rule: " + forwardingRuleName + " was created" );
298297 } catch (Exception e ) {
299- log .warn ("Could not create a forwarding rule " + forwardingRuleName + " " + e );
298+ log .error ("Could not create a forwarding rule " + forwardingRuleName , e );
300299 }
301- log .info ("Forwarding rule: " + forwardingRuleName + " was created" );
302300 }
303301
304302 /**
@@ -312,10 +310,10 @@ public void deleteForwardingRule(String forwardingRuleName) {
312310 Operation operation = compute .forwardingRules ().
313311 delete (PROJECT_ID , REGION_NAME , forwardingRuleName ).execute ();
314312 waitForRegionOperationCompletion (operation .getName ());
313+ log .info ("Forwarding rule " + forwardingRuleName + " was deleted" );
315314 } catch (Exception e ) {
316- log .warn ("Could not delete forwarding rule " + forwardingRuleName + " " + e );
315+ log .error ("Could not delete forwarding rule " + forwardingRuleName , e );
317316 }
318- log .info ("Forwarding rule " + forwardingRuleName + " was deleted" );
319317 }
320318
321319 /**
@@ -339,7 +337,7 @@ public boolean isTargetPoolExists(String targetPoolName) {
339337 }
340338 }
341339 } catch (IOException e ) {
342- log .warn ("Could not check whether the target pool " + targetPoolName + " exists or not " + e );
340+ log .error ("Could not check whether the target pool " + targetPoolName + " exists or not " , e );
343341 }
344342 if (log .isDebugEnabled ()) {
345343 log .debug ("Target pool " + targetPoolName + " does not exist" );
@@ -365,7 +363,7 @@ public TargetPool getTargetPool(String targetPoolName) {
365363 }
366364 return null ;
367365 } catch (IOException e ) {
368- log .warn ("Could not get target pool " + targetPoolName + " " + e );
366+ log .error ("Could not get target pool " + targetPoolName , e );
369367 }
370368 return null ;
371369 }
@@ -407,11 +405,10 @@ public void removeInstancesFromTargetPool(List<String> instancesIdsList, String
407405 Operation operation = compute .targetPools ().removeInstance (PROJECT_ID , REGION_NAME ,
408406 targetPoolName , targetPoolsRemoveInstanceRequest ).execute ();
409407 waitForRegionOperationCompletion (operation .getName ());
410-
408+ log . info ( "Instances are removed from target pool: " + targetPoolName );
411409 } catch (Exception e ) {
412- log .warn ("Could not remove instances from target pool " + targetPoolName + " " + e );
410+ log .error ("Could not remove instances from target pool " + targetPoolName , e );
413411 }
414- log .info ("Instances are removed from target pool: " + targetPoolName );
415412 }
416413
417414 /**
@@ -457,11 +454,10 @@ public void addInstancesToTargetPool(List<String> instancesIdsList, String targe
457454 Operation operation = compute .targetPools ().addInstance (PROJECT_ID , REGION_NAME ,
458455 targetPoolName , targetPoolsAddInstanceRequest ).execute ();
459456 waitForRegionOperationCompletion (operation .getName ());
460-
457+ log . info ( "Added instances to target pool: " + targetPoolName );
461458 } catch (Exception e ) {
462- log .warn ("Could not add instance to target pool" + targetPoolName + " " + e );
459+ log .error ("Could not add instance to target pool" + targetPoolName , e );
463460 }
464- log .info ("Added instances to target pool: " + targetPoolName );
465461 }
466462
467463 /**
@@ -484,23 +480,21 @@ public void createHealthCheck(String healthCheckName) {
484480 try {
485481 Operation operation = compute .httpHealthChecks ().insert (PROJECT_ID , httpHealthCheck ).execute ();
486482 waitForGlobalOperationCompletion (operation .getName ());
487-
483+ log . info ( "Health check " + healthCheckName + " was created" );
488484 } catch (Exception e ) {
489- log .error ("Could not create health check " + healthCheckName + " " + e );
485+ log .error ("Could not create health check " + healthCheckName , e );
490486 }
491- log .info ("Health check " + healthCheckName + " was created" );
492487 }
493488
494489 public void deleteHealthCheck (String healthCheckName ) {
495490 log .info ("Deleting Health Check: " + healthCheckName );
496491 try {
497492 Operation operation = compute .httpHealthChecks ().delete (PROJECT_ID , healthCheckName ).execute ();
498493 waitForGlobalOperationCompletion (operation .getName ());
499-
494+ log . info ( "Health check: " + healthCheckName + " was deleted" );
500495 } catch (Exception e ) {
501- log .warn ("Could not get delete health check " + healthCheckName + " " + e );
496+ log .error ("Could not get delete health check " + healthCheckName , e );
502497 }
503- log .info ("Health check: " + healthCheckName + " was deleted" );
504498 }
505499
506500 /**
@@ -535,7 +529,7 @@ private void waitForGlobalOperationCompletion(String operationName) throws LoadB
535529 timeout += 1000 ;
536530 }
537531 } catch (Exception e ) {
538- log .error ("Could not wait for global operation completion " + operationName );
532+ log .error ("Could not wait for global operation completion " + operationName , e );
539533 throw new LoadBalancerExtensionException (e );
540534 }
541535 }
@@ -570,7 +564,7 @@ private void waitForRegionOperationCompletion(String operationName) throws LoadB
570564 timeout += 1000 ;
571565 }
572566 } catch (Exception e ) {
573- log .error ("Could not wait for region operation completion " + operationName );
567+ log .error ("Could not wait for region operation completion " + operationName , e );
574568 throw new LoadBalancerExtensionException (e );
575569 }
576570 }
0 commit comments