Skip to content

Commit

Permalink
Merge pull request #5378 from payara/revert-FISH-1654
Browse files Browse the repository at this point in the history
Revert "Merge pull request #5327 from rdebusscher/FISH-1654"
  • Loading branch information
Cuba Stanley authored Aug 11, 2021
2 parents dc9e3a8 + d743b0d commit e9a3f2b
Show file tree
Hide file tree
Showing 13 changed files with 186 additions and 294 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2021] Payara Foundation and/or affiliates
package org.glassfish.admin.cli;

import com.sun.enterprise.admin.cli.AdminMain;
Expand All @@ -54,8 +53,7 @@ public static void main(String[] args) {
// Metrix.event("START");
Environment.setPrefix("AS_ADMIN_");
Environment.setShortPrefix("AS_");
// forceVerbose so that asadmin always runs with output to console
int code = new AsadminMain().doMain(args, true);
int code = new AsadminMain().doMain(args);
// Metrix.event("DONE");
// System.out.println("METRIX:");
// System.out.println(Metrix.getInstance().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if [ -z $DOMAIN_NAME ]; then echo "Variable DOMAIN_NAME is not set."; exit 1; fi
touch $PREBOOT_COMMANDS_FINAL
touch $POSTBOOT_COMMANDS_FINAL

OUTPUT=`${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} start-domain --verbose --dry-run --prebootcommandfile=${PREBOOT_COMMANDS_FINAL} --postbootcommandfile=${POSTBOOT_COMMANDS_FINAL} $@ $DOMAIN_NAME`
OUTPUT=`${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} start-domain --dry-run --prebootcommandfile=${PREBOOT_COMMANDS_FINAL} --postbootcommandfile=${POSTBOOT_COMMANDS_FINAL} $@ $DOMAIN_NAME`
STATUS=$?
if [ "$STATUS" -ne 0 ]
then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if [ -z $DOMAIN_NAME ]; then echo "Variable DOMAIN_NAME is not set."; exit 1; fi
touch $PREBOOT_COMMANDS_FINAL
touch $POSTBOOT_COMMANDS_FINAL

OUTPUT=`${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} start-domain --verbose --dry-run --prebootcommandfile=${PREBOOT_COMMANDS_FINAL} --postbootcommandfile=${POSTBOOT_COMMANDS_FINAL} $@ $DOMAIN_NAME`
OUTPUT=`${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} start-domain --dry-run --prebootcommandfile=${PREBOOT_COMMANDS_FINAL} --postbootcommandfile=${POSTBOOT_COMMANDS_FINAL} $@ $DOMAIN_NAME`
STATUS=$?
if [ "$STATUS" -ne 0 ]
then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2018-2021] Payara Foundation and/or affiliates
// Portions Copyright [2018] Payara Foundation and/or affiliates
package com.sun.enterprise.admin.cli;

import com.sun.enterprise.admin.remote.reader.ProprietaryReaderFactory;
Expand All @@ -54,7 +54,6 @@
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

import fish.payara.logging.LoggingUtil;
import org.glassfish.api.admin.CommandException;
import org.glassfish.api.admin.CommandValidationException;
import org.glassfish.api.admin.InvalidCommandException;
Expand Down Expand Up @@ -200,19 +199,11 @@ public synchronized String format(LogRecord record) {

public static void main(String[] args) {
AdminMain adminMain = new AdminMain();
int code = adminMain.doMain(args, false);
int code = adminMain.doMain(args);
System.exit(code);
}

protected int doMain(String[] args, boolean forceVerbose) {
// since this method is called to start an instance or the asadmin command
// we can force verbose mode for asadmin.
boolean verbose = false;
if (forceVerbose || Arrays.asList(args).contains("--logToConsole")) {
verbose = true;
System.setProperty(LoggingUtil.SYSTEM_PROPERTY_PAYARA_LOGGING_VERBOSE, "true");
}

protected int doMain(String[] args) {
int minor = JDK.getMinor();
int major = JDK.getMajor();
//In case of JDK1 to JDK8 the major version would be 1 always.Starting from
Expand Down Expand Up @@ -243,20 +234,17 @@ protected int doMain(String[] args, boolean forceVerbose) {
logger.setLevel(Level.FINE);
}
logger.setUseParentHandlers(false);
if (verbose) {
// Only when in verbose mode we have console that is visible.
Handler h = new CLILoggerHandler();
h.setLevel(logger.getLevel());
logger.addHandler(h);

// make sure the root logger uses our handler as well
Logger rlogger = Logger.getLogger("");
rlogger.setUseParentHandlers(false);
for (Handler lh : rlogger.getHandlers()) {
rlogger.removeHandler(lh);
}
rlogger.addHandler(h);
Handler h = new CLILoggerHandler();
h.setLevel(logger.getLevel());
logger.addHandler(h);

// make sure the root logger uses our handler as well
Logger rlogger = Logger.getLogger("");
rlogger.setUseParentHandlers(false);
for (Handler lh : rlogger.getHandlers()) {
rlogger.removeHandler(lh);
}
rlogger.addHandler(h);

if (debug) {
System.setProperty(CLIConstants.WALL_CLOCK_START_PROP, "" + System.currentTimeMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*
* Portions Copyright [2018-2021] [Payara Foundation and/or its affiliates]
* Portions Copyright [2018-2019] [Payara Foundation and/or its affiliates]
*/
package com.sun.enterprise.v3.admin.cluster;

Expand All @@ -57,7 +57,6 @@
import javax.inject.Inject;
import javax.validation.constraints.Min;

import fish.payara.logging.LoggingUtil;
import org.glassfish.api.ActionReport;
import org.glassfish.api.I18n;
import org.glassfish.api.Param;
Expand Down Expand Up @@ -282,11 +281,6 @@ private void startInstance(AdminCommandContext ctx) {
command.add("--debug");
}

boolean verbose = LoggingUtil.isVerboseMode();
if (verbose) {
command.add("--logToConsole");
}

command.add(instanceName);

// Convert the command into a string representing the command
Expand Down
1 change: 0 additions & 1 deletion nucleus/common/common-util/osgi.bundle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Bundle-Activator: org.glassfish.common.util.CommonUtilsActivator
com.sun.enterprise.util.uuid; \
com.sun.enterprise.util.zip; \
com.sun.logging; \
fish.payara.logging; \
org.glassfish.admin.payload; \
org.glassfish.common.util.admin; \
org.glassfish.common.util; \
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

import com.sun.enterprise.util.PropertyPlaceholderHelper;


import java.io.*;
import java.util.Properties;
import java.util.logging.LogManager;
Expand All @@ -56,8 +57,6 @@ public void readConfiguration(InputStream ins) throws IOException, SecurityExcep
// transform
configuration = new PropertyPlaceholderHelper(System.getenv(), PropertyPlaceholderHelper.ENV_REGEX).replacePropertiesPlaceholder(configuration);

LoggingUtil.handleConsoleHandlerLogic(configuration);

StringWriter writer = new StringWriter();
configuration.store(new PrintWriter(writer), null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
package com.sun.enterprise.glassfish.bootstrap;

import fish.payara.boot.runtime.BootCommands;
import fish.payara.logging.LoggingUtil;
import fish.payara.logging.PayaraLogManager;
import org.glassfish.embeddable.*;

Expand Down Expand Up @@ -71,28 +70,23 @@ public class GlassFishMain {

private static final Pattern COMMAND_PATTERN = Pattern.compile("([^\"']\\S*|\".*?\"|'.*?')\\s*");
private static final String[] COMMAND_TYPE = new String[0];
private static Logger LOGGER;
private static final Logger LOGGER;

// TODO(Sahoo): Move the code to ASMain once we are ready to phase out ASMain

static {
// This is not a JVM parameter in the domain as users should not have the possibility to not use the Payara Log Manager.
System.setProperty("java.util.logging.manager", PayaraLogManager.class.getName());
}

public static void main(final String args[]) throws Exception {

// Avoid triggering logging for the moment
final Properties argsAsProps = argsToMap(args);
boolean verbose = Boolean.parseBoolean(argsAsProps.getProperty("-verbose"));
System.setProperty(LoggingUtil.SYSTEM_PROPERTY_PAYARA_LOGGING_VERBOSE, Boolean.toString(verbose));

// Do not use as variable initialization as that will trigger LogManager before System property is set.
// And only after we have determined if we use verbose logging so that ConsoleHandler usage is correct.
LOGGER = Logger.getLogger(GlassFishMain.class.getName());
}

public static void main(final String args[]) throws Exception {
MainHelper.checkJdkVersion();

final Properties argsAsProps = argsToMap(args);

String platform = MainHelper.whichPlatform();

System.out.println("Launching Payara Server on " + platform + " platform");
Expand Down
3 changes: 1 addition & 2 deletions nucleus/core/logging/osgi.bundle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ DynamicImport-Package: \
com.trilead.ssh2, \
com.sun.enterprise.util.cluster.windows.io, \
com.sun.enterprise.util.cluster.windows.process, \
org.glassfish.cluster.ssh.util, \
fish.payara.logging
org.glassfish.cluster.ssh.util

Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import com.sun.enterprise.util.io.FileUtils;
import com.sun.enterprise.v3.logging.AgentFormatterDelegate;
import fish.payara.enterprise.server.logging.JSONLogFormatter;
import fish.payara.enterprise.server.logging.PayaraNotificationLogRotationTimer;
import fish.payara.enterprise.server.logging.PayaraNotificationLogRotationTimer;;
import java.io.*;
import java.security.PrivilegedAction;
import java.text.FieldPosition;
Expand All @@ -71,7 +71,6 @@
import java.util.zip.GZIPOutputStream;
import javax.inject.Inject;
import javax.inject.Singleton;

import org.glassfish.api.logging.Task;
import org.glassfish.config.support.TranslatedConfigView;
import org.glassfish.hk2.api.PostConstruct;
Expand Down Expand Up @@ -1067,7 +1066,6 @@ private boolean gzipFile(File infile) {
}

private void logStandardStreams() {

// redirect stderr and stdout, a better way to do this
//http://blogs.sun.com/nickstephen/entry/java_redirecting_system_out_and

Expand Down Expand Up @@ -1152,7 +1150,7 @@ public synchronized void setCompressionOnRotation(boolean compressionOnRotation)
this.compressionOnRotation = compressionOnRotation;
}

synchronized void setLogStandardStreams(boolean logStandardStreams) {
public synchronized void setLogStandardStreams(boolean logStandardStreams) {
this.logStandardStreams = logStandardStreams;

if (logStandardStreams) {
Expand Down
Loading

0 comments on commit e9a3f2b

Please sign in to comment.