Skip to content

Commit

Permalink
Merge pull request #126 from dmlloyd/lv
Browse files Browse the repository at this point in the history
Do not log versions if `jboss.log-version` is not `true`
  • Loading branch information
dmlloyd committed Sep 7, 2022
2 parents 3d41cee + eceb4cf commit a5e4e87
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 a5e4e87

Please sign in to comment.