forked from wildfly/wildfly-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request wildfly#5789 from yersan/WFCORE-6579
[WFCORE-6579] Allow process controller log file capture initial manag…
- Loading branch information
Showing
5 changed files
with
111 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
* @author <a href="mailto:[email protected]">David M. Lloyd</a> | ||
*/ | ||
public final class ProcessController { | ||
public static final String STDIO_ABOUT_TO_INSTALL_MSG = "--Installing Stdio Context--"; | ||
|
||
/** | ||
* Main lock - anything which opens a file descriptor or spawns a process must | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,11 @@ | |
|
||
package org.jboss.as.server; | ||
|
||
import static org.jboss.as.server.DomainServerCommunicationServices.createAuthenticationContext; | ||
|
||
import static org.jboss.as.process.protocol.StreamUtils.readBoolean; | ||
import static org.jboss.as.process.protocol.StreamUtils.readFully; | ||
import static org.jboss.as.process.protocol.StreamUtils.readInt; | ||
import static org.jboss.as.process.protocol.StreamUtils.readUTFZBytes; | ||
import static org.jboss.as.server.DomainServerCommunicationServices.createAuthenticationContext; | ||
|
||
import java.io.EOFException; | ||
import java.io.IOException; | ||
|
@@ -55,6 +54,9 @@ | |
* @author <a href="mailto:[email protected]">David M. Lloyd</a> | ||
*/ | ||
public final class DomainServerMain { | ||
// Capture System.out and System.err before they are redirected by STDIO | ||
private static final PrintStream STDOUT = System.out; | ||
private static final PrintStream STDERR = System.err; | ||
|
||
/** | ||
* Cache of the latest {@code AuthenticationContext} based on updates received | ||
|
@@ -81,6 +83,16 @@ public static void main(String[] args) { | |
} catch (Throwable ignored) { | ||
} | ||
|
||
// This message is not used to display any information on the stdout and stderr of this process, it signals the | ||
// Process Controller to switch the stdout and stderr of this managed process from the process controller log to | ||
// the process controller stdout and stderr. | ||
// Once the StdioContext gets installed, both the stdout and stderr of this managed process will be captured, | ||
// aggregated and handled by this process logging framework. | ||
STDOUT.println(ProcessController.STDIO_ABOUT_TO_INSTALL_MSG); | ||
STDOUT.flush(); | ||
STDERR.println(ProcessController.STDIO_ABOUT_TO_INSTALL_MSG); | ||
STDERR.flush(); | ||
|
||
// Install JBoss Stdio to avoid any nasty crosstalk. | ||
StdioContext.install(); | ||
final StdioContext context = StdioContext.create( | ||
|