From 0c748601e8bd42d9796169cdcda310944d3a5a92 Mon Sep 17 00:00:00 2001 From: Artem Vysochyn Date: Tue, 8 Oct 2024 21:28:18 +0300 Subject: [PATCH] Improved number pattern in logs --- .../java/io/scalecube/config/vault/VaultInvoker.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/config-vault/src/main/java/io/scalecube/config/vault/VaultInvoker.java b/config-vault/src/main/java/io/scalecube/config/vault/VaultInvoker.java index 57938f8..7f91a5a 100644 --- a/config-vault/src/main/java/io/scalecube/config/vault/VaultInvoker.java +++ b/config-vault/src/main/java/io/scalecube/config/vault/VaultInvoker.java @@ -94,7 +94,11 @@ private synchronized Vault recreateVault(Vault prev) throws VaultException { long delay = TimeUnit.SECONDS.toMillis(suggestedRefreshInterval(ttl)); timer = new Timer("VaultScheduler", true); timer.schedule(new RenewTokenTask(), delay); - LOGGER.log(Level.INFO, "Renew token timer was set to {0}sec, (TTL = {1}sec)", delay, ttl); + LOGGER.log( + Level.INFO, + "Renew token timer was set to {0,number,#}s, (TTL = {1,number,#}s)", + delay, + ttl); } else { LOGGER.log(Level.WARNING, "Vault token is not renewable"); } @@ -114,15 +118,13 @@ private void renewToken() throws VaultException { try { AuthResponse response = vault.auth().renewSelf(); long ttl = response.getAuthLeaseDuration(); - if (LOGGER.isLoggable(Level.DEBUG)) { - LOGGER.log(Level.DEBUG, "Token was successfully renewed (new TTL = {0}sec)", ttl); - } + LOGGER.log(Level.DEBUG, "Token was successfully renewed (new TTL = {0,number,#}s)", ttl); if (response.isAuthRenewable()) { if (ttl > 1) { long delay = TimeUnit.SECONDS.toMillis(suggestedRefreshInterval(ttl)); timer.schedule(new RenewTokenTask(), delay); } else { - LOGGER.log(Level.WARNING, "Token TTL ({0}sec) is not enough for scheduling", ttl); + LOGGER.log(Level.WARNING, "Token TTL ({0,number,#}s) is not enough for scheduling", ttl); vault = recreateVault(vault); } } else {