Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Currently GEODE is "swallowing" all output sent to stdout and stderr by default and there's no way of changing this behavior when starting members through gfsh.
This, between other things, prevents users from playing around with System.out.println() during development phases, there could even be certain scenarios where some critical piece of information that comes out through stdout somehow bypassed all the logging frameworks. Not only that, but this also prevents the user from getting thread dumps by executing a plain kill -3 or kill -QUIT using the processId, which is critical in troubleshooting.
Currently there are two internal flags that can be used to prevent this default behavior, both have to be used at the same time and both are very counterintuitive gemfire.OSProcess.ENABLE_OUTPUT_REDIRECTION=true and gemfire.OSProcess.DISABLE_OUTPUT_REDIRECTION=false. These flags, however, don't work at all when starting members through gfsh, and that's because the relevant commands wrongly assume that the flags are already part of the system properties too early in the lifecylce execution of the command:
@CliCommand(value = CliStrings.START_LOCATOR, help = CliStrings.START_LOCATOR__HELP) @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_LOCATOR, CliStrings.TOPIC_GEODE_LIFECYCLE}) public Result startLocator(...) throws Exception { (...) final boolean redirectOutput = Boolean.getBoolean(OSProcess.ENABLE_OUTPUT_REDIRECTION_PROPERTY); LocatorLauncher.Builder locatorLauncherBuilder = new LocatorLauncher.Builder() .setRedirectOutput(redirectOutput) (...) }
@CliCommand(value = CliStrings.START_SERVER, help = CliStrings.START_SERVER__HELP) @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_SERVER, CliStrings.TOPIC_GEODE_LIFECYCLE}) public Result startServer(...) throws Exception { (...) final boolean redirectOutput = Boolean.getBoolean(OSProcess.ENABLE_OUTPUT_REDIRECTION_PROPERTY); ServerLauncher.Builder serverLauncherBuilder = new ServerLauncher.Builder() .setRedirectOutput(redirectOutput) (...)
At this stage during the execution, the system properties used when starting the members haven't been fully parsed yet and the flags only present within the sun.java.command system property, so Boolean.getBoolean(OSProcess.ENABLE_OUTPUT_REDIRECTION_PROPERTY) will always return false.
The goal of the current JIRA is to add a --redirect-ouput flag to the start commands in GFSH and deprecate the properties OSProcess.DISABLE_OUTPUT_REDIRECTION and OSProcess.ENABLE_OUTPUT_REDIRECTION; unfortunately they can't be directly deleted because, even when they are internal, they've been referenced several times in external articles to workaround older issues.