]> source.dussan.org Git - sonarqube.git/commitdiff
Log the Java version
authorJulien HENRY <julien.henry@sonarsource.com>
Tue, 7 May 2024 10:50:18 +0000 (12:50 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 13 May 2024 20:02:41 +0000 (20:02 +0000)
sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerMain.java

index 1dbafef4ce9abe8f2df02950378124497f4e6e06..887844a1756737f8574b5719abebc4a3428c102d 100644 (file)
@@ -55,6 +55,7 @@ public class ScannerMain {
   public static int run(InputStream in) {
     try {
       LOG.info("Starting SonarScanner Engine...");
+      LOG.atInfo().log(ScannerMain::java);
 
       var properties = parseInputProperties(in);
 
@@ -72,6 +73,20 @@ public class ScannerMain {
     }
   }
 
+  static String java() {
+    StringBuilder sb = new StringBuilder();
+    sb
+      .append("Java ")
+      .append(System.getProperty("java.version"))
+      .append(" ")
+      .append(System.getProperty("java.vendor"));
+    String bits = System.getProperty("sun.arch.data.model");
+    if ("32".equals(bits) || "64".equals(bits)) {
+      sb.append(" (").append(bits).append("-bit)");
+    }
+    return sb.toString();
+  }
+
   private static void handleException(Exception e) {
     var messageException = unwrapMessageException(e);
     if (messageException.isPresent()) {