Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
slim down console output with environment variable
  • Loading branch information
CarolynRountree committed Jan 31, 2022
commit b8c201cbece57c78eaab8a8972cda329245a95a0
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, Oracle Corporation and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
*/
package oracle.weblogic.deploy.logging;
Expand Down Expand Up @@ -276,6 +276,7 @@ private int getSize(String propSize) {
private Handler getConsoleHandler() {
Handler handler = LoggingUtils.getHandlerInstance(WLSDeployLoggingConfig.getStdoutHandler());
handler.setFilter(null);
handler.setLevel(Level.INFO);
return handler;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2022, Oracle Corporation and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2022, Oracle Corporation and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
*/
package oracle.weblogic.deploy.logging;
Expand Down Expand Up @@ -107,6 +107,11 @@ public class WLSDeployLoggingConfig {
*/
public static final String WLSDEPLOY_DEBUG_TO_STDOUT_PROP = WLSDEPLOY_LOGGER_NAME + ".debugToStdout";

/**
* The environment variable used to minimize console log statements.
*/
public static final String WLSDEPLOY_TURN_OFF_CONSOLE = "WLSDEPLOY_TURN_OFF_CONSOLE";

private static File loggingDirectory;
private static File loggingPropertiesFile;

Expand Down Expand Up @@ -290,11 +295,16 @@ private static void configureConsoleHandler(Properties logProps) {

private static void configureStdoutConsoleHandler(Properties logProps) {
String consoleHandler = getStdoutHandler();
String debugToStdoutString = System.getProperty(WLSDEPLOY_DEBUG_TO_STDOUT_PROP, DEFAULT_DEBUG_TO_STDOUT);
if (Boolean.parseBoolean(debugToStdoutString)) {
logProps.setProperty(consoleHandler + HANDLER_LEVEL_PROP, Level.ALL.toString());
Boolean noOutputToStdoutString = new Boolean(System.getenv(WLSDEPLOY_TURN_OFF_CONSOLE));
if (noOutputToStdoutString) {
logProps.setProperty(consoleHandler + HANDLER_LEVEL_PROP, Level.OFF.toString());
} else {
logProps.setProperty(consoleHandler + HANDLER_LEVEL_PROP, DEFAULT_CONSOLE_HANDLER_LEVEL);
String debugToStdoutString = System.getProperty(WLSDEPLOY_DEBUG_TO_STDOUT_PROP, DEFAULT_DEBUG_TO_STDOUT);
if (Boolean.parseBoolean(debugToStdoutString)) {
logProps.setProperty(consoleHandler + HANDLER_LEVEL_PROP, Level.ALL.toString());
} else {
logProps.setProperty(consoleHandler + HANDLER_LEVEL_PROP, DEFAULT_CONSOLE_HANDLER_LEVEL);
}
}
logProps.setProperty(consoleHandler + HANDLER_FORMATTER_PROP, DEFAULT_CONSOLE_FORMATTER_PROP);
logProps.setProperty(consoleHandler + HANDLER_FILTER_PROP, DEFAULT_STDOUT_FILTER_PROP);
Expand Down