From 2238ca95940951e22fed3ad71216476ac059df86 Mon Sep 17 00:00:00 2001 From: lilgreenbird Date: Thu, 18 Apr 2019 18:25:35 -0700 Subject: [PATCH] enable logging to stream by default --- .../sqlserver/testframework/AbstractTest.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/test/java/com/microsoft/sqlserver/testframework/AbstractTest.java b/src/test/java/com/microsoft/sqlserver/testframework/AbstractTest.java index 184f31bb8..d888db9bd 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/AbstractTest.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/AbstractTest.java @@ -243,14 +243,16 @@ public static String getConfiguredProperty(String key, String defaultValue) { public static void invokeLogging() { Handler handler = null; - String enableLogging = getConfiguredProperty(Constants.MSSQL_JDBC_LOGGING, Boolean.FALSE.toString()); + // enable logging to stream by default for tests + String enableLogging = getConfiguredProperty(Constants.MSSQL_JDBC_LOGGING, Boolean.TRUE.toString()); // If logging is not enable then return. if (!Boolean.TRUE.toString().equalsIgnoreCase(enableLogging)) { return; } - String loggingHandler = getConfiguredProperty(Constants.MSSQL_JDBC_LOGGING_HANDLER, "not_configured"); + String loggingHandler = getConfiguredProperty(Constants.MSSQL_JDBC_LOGGING_HANDLER, + Constants.LOGGING_HANDLER_STREAM); try { if (Constants.LOGGING_HANDLER_CONSOLE.equalsIgnoreCase(loggingHandler)) { @@ -269,16 +271,15 @@ public static void invokeLogging() { Logger.getLogger(Constants.MSSQL_JDBC_LOGGING_HANDLER).addHandler(handler); } + // enable activity trace + TestUtils.setActivityTraceOn(); + /* * By default, Loggers also send their output to their parent logger. Typically the root Logger is * configured with a set of Handlers that essentially act as default handlers for all loggers. */ Logger logger = Logger.getLogger(Constants.MSSQL_JDBC_PACKAGE); logger.setLevel(Level.FINEST); - - // enable activity trace - TestUtils.setActivityTraceOn(); - } catch (Exception e) { System.err.println("Could not invoke logging: " + e.getMessage()); }