Skip to content

Commit

Permalink
#334 - fix log message pattern to include parameter index (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gozke authored Aug 16, 2024
1 parent 4bbf898 commit bcc7cda
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void send(StandardCredentials credentials, Verb verb, String url, String
logger.log(Level.FINEST, "Result of the status notification is: {0}, with status code: {1}",
new Object[] {responseBody, response.getStatusLine().getStatusCode()});
} catch (IOException e) {
logger.log(Level.WARNING, "Error during state notification: {} ", e.getMessage());
logger.log(Level.WARNING, "Error during state notification: {0} ", e.getMessage());
}
else if (credentials instanceof StringCredentials) {
try {
Expand All @@ -69,7 +69,7 @@ else if (credentials instanceof StringCredentials) {
logger.log(Level.FINEST, "Result of the state notification is: {0}, with status code: {1}",
new Object[] {response.getBody(), response.getCode()});
} catch (ExecutionException | IOException e) {
logger.log(Level.WARNING, "Error during state notification: {} ", e.getMessage());
logger.log(Level.WARNING, "Error during state notification: {0} ", e.getMessage());
} catch (InterruptedException e) {
throw e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void send(StandardCredentials credentials, Verb verb, String url, String
logger.log(Level.FINEST, "Result of the status notification is: {0}, with status code: {1}",
new Object[] {responseBody, response.getStatusLine().getStatusCode()});
} catch (IOException e) {
logger.log(Level.WARNING, "Error during state notification: {} ", e.getMessage());
logger.log(Level.WARNING, "Error during state notification: {0} ", e.getMessage());
}
else if (credentials instanceof StringCredentials)
try {
Expand All @@ -73,7 +73,7 @@ else if (credentials instanceof StringCredentials)
response.getStatusLine().getStatusCode()});
} catch (ExecutionException | IOException | KeyManagementException | NoSuchAlgorithmException
| KeyStoreException e) {
logger.log(Level.WARNING, "Error du" + "ring state notification: {} ", e.getMessage());
logger.log(Level.WARNING, "Error du" + "ring state notification: {0} ", e.getMessage());
} catch (InterruptedException e) {
throw e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static boolean matchWithRegex(@Nonnull String haystack, @Nonnull String p
}

if (patternStr == null || patternStr.trim().isEmpty()) {
logger.fine(String.format("The regex filter on the comment from BB is null or it is empty", new Object[] {}));
logger.fine("The regex filter on the comment from BB is null or it is empty");
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected void callClient(@Nonnull String url, @Nonnull Map<String, String> payl
String jsonPayload = objectMapper.writeValueAsString(payload);
BitBucketPPRClientFactory.createClient(clientType, context).send(url, jsonPayload);
} catch (JsonProcessingException e) {
logger.log(Level.WARNING, "Cannot create payload: {}", e.getMessage());
logger.log(Level.WARNING, "Cannot create payload: {0}", e.getMessage());
} catch (Exception e) {
logger.warning(e.getMessage());
}
Expand All @@ -104,7 +104,7 @@ protected void callClient(@Nonnull Verb verb, @Nonnull String url,
String jsonPayload = payload.isEmpty() ? "" : objectMapper.writeValueAsString(payload);
BitBucketPPRClientFactory.createClient(clientType, context).send(verb, url, jsonPayload);
} catch (JsonProcessingException e) {
logger.log(Level.WARNING, "Cannot create payload: {}", e.getMessage());
logger.log(Level.WARNING, "Cannot create payload: {0}", e.getMessage());
} catch (Exception e) {
logger.warning(e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,28 @@ public static BitBucketPPRObservable createObservable(

if (REPOSITORY_EVENT.equalsIgnoreCase(bitbucketEvent.getEvent())
&& REPOSITORY_CLOUD_PUSH.equalsIgnoreCase(bitbucketEvent.getAction())) {
logger.log(Level.FINE, "Add BitBucketPPRPushCloudObserver for {}", bitbucketEvent);
logger.log(Level.FINE, "Add BitBucketPPRPushCloudObserver for {0}", bitbucketEvent);
observable.addObserver(new BitBucketPPRPushCloudObserver());
}

if (REPOSITORY_EVENT.equalsIgnoreCase(bitbucketEvent.getEvent())
&& REPOSITORY_SERVER_PUSH.equalsIgnoreCase(bitbucketEvent.getAction())) {
logger.log(Level.FINE, "Add BitBucketPPRPushServerObserver for {}", bitbucketEvent);
logger.log(Level.FINE, "Add BitBucketPPRPushServerObserver for {0}", bitbucketEvent);
observable.addObserver(new BitBucketPPRPushServerObserver());
}

if (PULL_REQUEST_CLOUD_EVENT.equals(bitbucketEvent.getEvent())) {
logger.log(Level.FINE, "Add BitBucketPPRPullRequestCloudObserver for {}", bitbucketEvent);
logger.log(Level.FINE, "Add BitBucketPPRPullRequestCloudObserver for {0}", bitbucketEvent);
observable.addObserver(new BitBucketPPRPullRequestCloudObserver());
}

if (PULL_REQUEST_SERVER_EVENT.equals(bitbucketEvent.getEvent())) {
logger.log(Level.FINE, "Add BitBucketPPRPullRequestServerObserver for {}", bitbucketEvent);
logger.log(Level.FINE, "Add BitBucketPPRPullRequestServerObserver for {0}", bitbucketEvent);
observable.addObserver(new BitBucketPPRPullRequestServerObserver());
}

if (observable.getObservers().isEmpty())
logger.log(Level.FINE, "No observer found for the observable of event {}", bitbucketEvent);
logger.log(Level.FINE, "No observer found for the observable of event {0}", bitbucketEvent);

return observable;
}
Expand Down

0 comments on commit bcc7cda

Please sign in to comment.