From dfba9bf9a98768dbd29e6ad877542ae4bc1be731 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Fri, 5 Aug 2022 13:59:16 -0700 Subject: [PATCH] More debug --- .../agent/bootstrap/AzureFunctions.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/agent/agent-bootstrap/src/main/java/com/microsoft/applicationinsights/agent/bootstrap/AzureFunctions.java b/agent/agent-bootstrap/src/main/java/com/microsoft/applicationinsights/agent/bootstrap/AzureFunctions.java index cd747451e3..e35c28f338 100644 --- a/agent/agent-bootstrap/src/main/java/com/microsoft/applicationinsights/agent/bootstrap/AzureFunctions.java +++ b/agent/agent-bootstrap/src/main/java/com/microsoft/applicationinsights/agent/bootstrap/AzureFunctions.java @@ -45,18 +45,25 @@ public static boolean hasConnectionString() { public static void configureOnce() { LoggerFactory.getLogger(DiagnosticsHelper.DIAGNOSTICS_LOGGER_NAME) .warn("AzureFunctions.configureOnce(): enter"); - if (configure != null) { - LoggerFactory.getLogger(DiagnosticsHelper.DIAGNOSTICS_LOGGER_NAME) - .warn("AzureFunctions.configureOnce(): configure != null"); - if (!hasConnectionString()) { + try { + if (configure != null) { LoggerFactory.getLogger(DiagnosticsHelper.DIAGNOSTICS_LOGGER_NAME) - .warn("AzureFunctions.configureOnce(): !hasConnectionString()"); - configure.run(); + .warn("AzureFunctions.configureOnce(): configure != null"); + if (!hasConnectionString()) { + LoggerFactory.getLogger(DiagnosticsHelper.DIAGNOSTICS_LOGGER_NAME) + .warn("AzureFunctions.configureOnce(): !hasConnectionString()"); + configure.run(); + } + configure = null; } - configure = null; + } catch (Throwable t) { + LoggerFactory.getLogger(DiagnosticsHelper.DIAGNOSTICS_LOGGER_NAME) + .warn("AzureFunctions.configureOnce(): error " + t); + LoggerFactory.getLogger(DiagnosticsHelper.DIAGNOSTICS_LOGGER_NAME).warn(t.getMessage(), t); + } finally { + LoggerFactory.getLogger(DiagnosticsHelper.DIAGNOSTICS_LOGGER_NAME) + .warn("AzureFunctions.configureOnce(): exit"); } - LoggerFactory.getLogger(DiagnosticsHelper.DIAGNOSTICS_LOGGER_NAME) - .warn("AzureFunctions.configureOnce(): exit"); } private AzureFunctions() {}