Skip to content

Commit

Permalink
enable logging to stream by default
Browse files Browse the repository at this point in the history
  • Loading branch information
lilgreenbird committed Apr 19, 2019
1 parent acad4ce commit 2238ca9
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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());
}
Expand Down

0 comments on commit 2238ca9

Please sign in to comment.