diff --git a/core-feature-pack/galleon-feature-pack/src/main/resources/packages/product.conf/content/modules/system/layers/base/org/jboss/as/product/wildfly-core/module.xml b/core-feature-pack/galleon-feature-pack/src/main/resources/packages/product.conf/content/modules/system/layers/base/org/jboss/as/product/wildfly-core/module.xml index a24ced5bb39..46b02e52e42 100644 --- a/core-feature-pack/galleon-feature-pack/src/main/resources/packages/product.conf/content/modules/system/layers/base/org/jboss/as/product/wildfly-core/module.xml +++ b/core-feature-pack/galleon-feature-pack/src/main/resources/packages/product.conf/content/modules/system/layers/base/org/jboss/as/product/wildfly-core/module.xml @@ -16,4 +16,4 @@ - + \ No newline at end of file diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java b/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java index c7aa92a746d..55cf88ed816 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java @@ -479,6 +479,7 @@ public HostControllerEnvironment(Map hostSystemProperties, boole this.hostControllerUUID = uuid; this.backupDomainFiles = backupDomainFiles; this.useCachedDc = useCachedDc; + ProductConfig.getBannerFile(productConfig, homeDir.getAbsolutePath()); this.productConfig = productConfig; // Note the java.security.manager property shouldn't be set, but we'll check to ensure the security manager should be enabled this.securityManagerEnabled = securityManagerEnabled || isJavaSecurityManagerConfigured(hostSystemProperties); diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerService.java b/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerService.java index 493d20b02a9..80ecc07745e 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerService.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerService.java @@ -103,7 +103,8 @@ public void start(StartContext context) throws StartException { // processState.setStarting(); final ProductConfig config = environment.getProductConfig(); final String prettyVersion = config.getPrettyVersionString(); - ServerLogger.AS_ROOT_LOGGER.serverStarting(prettyVersion); + final String banner = environment.getStability() == org.jboss.as.version.Stability.EXPERIMENTAL ? config.getBanner() : ""; + ServerLogger.AS_ROOT_LOGGER.serverStarting(prettyVersion, banner); if (System.getSecurityManager() != null) { ServerLogger.AS_ROOT_LOGGER.securityManagerEnabled(); } diff --git a/server/src/main/java/org/jboss/as/server/ApplicationServerService.java b/server/src/main/java/org/jboss/as/server/ApplicationServerService.java index a67f628e8a9..663897bf8d6 100644 --- a/server/src/main/java/org/jboss/as/server/ApplicationServerService.java +++ b/server/src/main/java/org/jboss/as/server/ApplicationServerService.java @@ -82,7 +82,8 @@ public synchronized void start(final StartContext context) throws StartException final ServerEnvironment serverEnvironment = configuration.getServerEnvironment(); final ProductConfig config = serverEnvironment.getProductConfig(); final String prettyVersion = config.getPrettyVersionString(); - ServerLogger.AS_ROOT_LOGGER.serverStarting(prettyVersion); + final String banner = serverEnvironment.getStability() == org.jboss.as.version.Stability.EXPERIMENTAL ? config.getBanner() : ""; + ServerLogger.AS_ROOT_LOGGER.serverStarting(prettyVersion, banner); if (System.getSecurityManager() != null) { ServerLogger.AS_ROOT_LOGGER.securityManagerEnabled(); } diff --git a/server/src/main/java/org/jboss/as/server/ServerEnvironment.java b/server/src/main/java/org/jboss/as/server/ServerEnvironment.java index 40019885b5e..364a6183759 100644 --- a/server/src/main/java/org/jboss/as/server/ServerEnvironment.java +++ b/server/src/main/java/org/jboss/as/server/ServerEnvironment.java @@ -549,6 +549,7 @@ public ServerEnvironment(final String hostControllerName, final Properties props throw ServerLogger.ROOT_LOGGER.couldNotObtainServerUuidFile(ex, filePath); } this.serverUUID = uuid; + ProductConfig.getBannerFile(productConfig, homeDir.getAbsolutePath()); this.productConfig = productConfig; // Keep a copy of the original properties diff --git a/server/src/main/java/org/jboss/as/server/logging/ServerLogger.java b/server/src/main/java/org/jboss/as/server/logging/ServerLogger.java index 087649a87c9..5d56a10127c 100644 --- a/server/src/main/java/org/jboss/as/server/logging/ServerLogger.java +++ b/server/src/main/java/org/jboss/as/server/logging/ServerLogger.java @@ -317,10 +317,11 @@ public interface ServerLogger extends BasicLogger { * Logs an informational message indicating the server is starting. * * @param prettyVersion the server version. + * @param banner the server ACII banner. */ @LogMessage(level = INFO) - @Message(id = 49, value = "%s starting") - void serverStarting(String prettyVersion); + @Message(id = 49, value = "%s starting%s") + void serverStarting(String prettyVersion, String banner); /** * Logs an informational message indicating the server is stopped. diff --git a/version/src/main/java/org/jboss/as/version/ProductConfig.java b/version/src/main/java/org/jboss/as/version/ProductConfig.java index ec491412644..653cae486b2 100644 --- a/version/src/main/java/org/jboss/as/version/ProductConfig.java +++ b/version/src/main/java/org/jboss/as/version/ProductConfig.java @@ -12,6 +12,7 @@ import java.io.Serializable; import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.security.AccessController; import java.security.PrivilegedAction; @@ -34,19 +35,20 @@ public class ProductConfig implements Serializable { private final String name; private final String version; + private String banner; private final String consoleSlot; private final Stability defaultStability; private final Set stabilities; private boolean isProduct; public static ProductConfig fromFilesystemSlot(ModuleLoader loader, String home, Map providedProperties) { - return new ProductConfig(loader, getProductConfProperties(home), providedProperties); + return new ProductConfig(loader, home, getProductConfProperties(home), providedProperties); } public static ProductConfig fromKnownSlot(String slot, ModuleLoader loader, Map providedProperties) { - return new ProductConfig(loader, new ProductConfProps(slot), providedProperties); + return new ProductConfig(loader, null, new ProductConfProps(slot), providedProperties); } - private ProductConfig(ModuleLoader loader, ProductConfProps productConfProps, Map providedProperties) { + private ProductConfig(ModuleLoader loader, String home, ProductConfProps productConfProps, Map providedProperties) { String productName = null; String projectName = null; String productVersion = null; @@ -81,6 +83,7 @@ private ProductConfig(ModuleLoader loader, ProductConfProps productConfProps, Ma minStability = Stability.fromString(minStabilityValue); } } + getBannerFile(this, home); } setSystemProperties(productConfProps.miscProperties, providedProperties); @@ -97,6 +100,19 @@ private ProductConfig(ModuleLoader loader, ProductConfProps productConfProps, Ma this.stabilities = EnumSet.range(maxStability, minStability); } + public static void getBannerFile(ProductConfig config, String home) { + if (home != null) { + Path bannerPath = Paths.get(home, "bin", "banner.txt"); + if (bannerPath != null && Files.exists(bannerPath)) { + try { + config.banner = System.lineSeparator() + Files.readString(bannerPath, StandardCharsets.UTF_8); + } catch (Exception e) { + // Don't care + } + } + } + } + private static String getProductConf(String home) { final String defaultVal = home + File.separator + "bin" + File.separator + "product.conf"; PrivilegedAction action = new PrivilegedAction() { @@ -133,6 +149,7 @@ public ProductConfig(final String productName, final String productVersion, fina this.consoleSlot = consoleSlot; this.defaultStability = Stability.DEFAULT; this.stabilities = EnumSet.of(this.defaultStability); + this.banner = null; } public String getProductName() { @@ -167,6 +184,14 @@ public Set getStabilitySet() { return this.stabilities; } + /** + * The product ASCII banner defined in $JBOSS_HOME\bin\banner.txt using \n as line ending. + * @return the ASCII banner. + */ + public String getBanner() { + return banner; + } + public String getPrettyVersionString() { if (name != null) { return String.format("%s %s (WildFly Core %s)", name, version, Version.AS_VERSION);