[FEATURE] Print java version in version command

This commit is contained in:
Gravita 2021-05-04 19:26:00 +07:00
parent f188378fd6
commit ea7159dba6
2 changed files with 11 additions and 2 deletions

View file

@ -1,11 +1,17 @@
package pro.gravit.launchserver.command.basic;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import pro.gravit.launchserver.LaunchServer;
import pro.gravit.launchserver.command.Command;
import pro.gravit.utils.Version;
import pro.gravit.utils.helper.JVMHelper;
import pro.gravit.utils.helper.LogHelper;
import java.lang.management.RuntimeMXBean;
public final class VersionCommand extends Command {
private transient final Logger logger = LogManager.getLogger();
public VersionCommand(LaunchServer server) {
super(server);
}
@ -22,6 +28,9 @@ public String getUsageDescription() {
@Override
public void invoke(String... args) {
LogHelper.subInfo("LaunchServer version: %d.%d.%d (build #%d)", Version.MAJOR, Version.MINOR, Version.PATCH, Version.BUILD);
logger.info("LaunchServer version: {}.{}.{} (build #{})", Version.MAJOR, Version.MINOR, Version.PATCH, Version.BUILD);
RuntimeMXBean mxBean = JVMHelper.RUNTIME_MXBEAN;
logger.info("Java {}({})", JVMHelper.getVersion(), mxBean.getVmVersion());
logger.info("Java Home: {}", System.getProperty("java.home", "UNKNOWN"));
}
}

View file

@ -14,7 +14,7 @@
import java.util.Arrays;
public class ModulesCommand extends Command {
private transient Logger logger = LogManager.getLogger();
private transient final Logger logger = LogManager.getLogger();
public ModulesCommand(LaunchServer server) {
super(server);
}