Skip to content

Commit

Permalink
Do not log versions if jboss.log-version is not true
Browse files Browse the repository at this point in the history
Co-authored-by: Guillaume Smet <[email protected]>
  • Loading branch information
dmlloyd and gsmet committed Aug 26, 2022
1 parent 197346e commit eceb4cf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/org/jboss/threads/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Properties;

/**
Expand All @@ -48,11 +50,20 @@ private Version() {
}
JAR_NAME = jarName;
VERSION_STRING = versionString;
try {
boolean logVersion = AccessController.doPrivileged((PrivilegedAction<Boolean>) Version::shouldLogVersion).booleanValue();
if (logVersion) try {
Messages.msg.version(versionString);
} catch (Throwable ignored) {}
}

private static Boolean shouldLogVersion() {
try {
return Boolean.valueOf(System.getProperty("jboss.log-version", "true"));
} catch (Throwable ignored) {
return Boolean.FALSE;
}
}

/**
* Get the name of the JBoss Modules JAR.
*
Expand Down

0 comments on commit eceb4cf

Please sign in to comment.