Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAYARA-3708 Implemented fixes for JLine Logging #3867

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -133,7 +133,10 @@ public abstract class CLICommand implements PostConstruct {
};
private String manpageTokenValues[] = new String[manpageTokens.length];


static{
checkToDisableJLineLogging();
}

/**
* The name of the command.
* Initialized in the constructor.
Expand Down Expand Up @@ -1388,4 +1391,17 @@ private static void file2Set(String file, Set<String> set) {
e.printStackTrace();
}
}

private static void checkToDisableJLineLogging(){
if (Boolean.getBoolean("fish.payara.admin.command.jline.log.disable")) {
System.setProperty("jline.log.jul", "false");
final OutputStream noOpOutputStream = new OutputStream() {
@Override
public void write(int b) throws IOException {
//NO-OP
}
};
jline.internal.Log.setOutput(new PrintStream(noOpOutputStream));
}
}
}
Expand Up @@ -137,8 +137,7 @@ protected Collection<ParamModel> usageOptions() {
protected int executeCommand() throws CommandException, CommandValidationException {
ConsoleReader reader = null;
programOpts.setEcho(echo); // restore echo flag, saved in validate
try {
checkToDisableJLineLogging();
try {
if (file == null) {
System.out.println(strings.get("multimodeIntro"));
reader = new ConsoleReader(ASADMIN, System.in, System.out, null, encoding);
Expand Down Expand Up @@ -185,19 +184,6 @@ public void write(byte[] b, int off, int len) throws IOException {
}
}
}

private static void checkToDisableJLineLogging(){
if (Boolean.getBoolean("fish.payara.admin.command.jline.log.disable")) {
System.setProperty("jline.log.jul", "false");
final OutputStream noOpOutputStream = new OutputStream() {
@Override
public void write(int b) throws IOException {
//NO-OP
}
};
jline.internal.Log.setOutput(new PrintStream(noOpOutputStream));
}
}

private static void atomicReplace(ServiceLocator locator, ProgramOptions options) {
DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class);
Expand Down