Browse Source

fix #388 : print jvm parameters

Shinsuke Sugaya 9 years ago
parent
commit
43e5eaaf3d

+ 19 - 0
src/main/java/org/codelibs/fess/exec/Crawler.java

@@ -18,6 +18,7 @@ package org.codelibs.fess.exec;
 import java.io.File;
 import java.io.IOException;
 import java.io.Serializable;
+import java.lang.management.ManagementFactory;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
@@ -140,6 +141,13 @@ public class Crawler implements Serializable {
             return idList;
         }
 
+        @Override
+        public String toString() {
+            return "Options [sessionId=" + sessionId + ", name=" + name + ", webConfigIds=" + webConfigIds + ", fileConfigIds="
+                    + fileConfigIds + ", dataConfigIds=" + dataConfigIds + ", propertiesPath=" + propertiesPath + ", expires=" + expires
+                    + "]";
+        }
+
     }
 
     public static void main(final String[] args) {
@@ -155,6 +163,17 @@ public class Crawler implements Serializable {
             return;
         }
 
+        if (logger.isDebugEnabled()) {
+            try {
+                ManagementFactory.getRuntimeMXBean().getInputArguments().stream().forEach(s -> logger.debug("Parameter: " + s));
+                System.getProperties().entrySet().stream().forEach(e -> logger.debug("Property: " + e.getKey() + "=" + e.getValue()));
+                System.getenv().entrySet().forEach(e -> logger.debug("Env: " + e.getKey() + "=" + e.getValue()));
+                logger.debug("Option: " + options);
+            } catch (Exception e) {
+                // ignore
+            }
+        }
+
         final String transportAddresses = System.getProperty(Constants.FESS_ES_TRANSPORT_ADDRESSES);
         if (StringUtil.isNotBlank(transportAddresses)) {
             System.setProperty(EsClient.TRANSPORT_ADDRESSES, transportAddresses);

+ 17 - 0
src/main/java/org/codelibs/fess/exec/SuggestCreator.java

@@ -18,6 +18,7 @@ package org.codelibs.fess.exec;
 import java.io.File;
 import java.io.IOException;
 import java.io.Serializable;
+import java.lang.management.ManagementFactory;
 import java.time.LocalDateTime;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -60,6 +61,11 @@ public class SuggestCreator implements Serializable {
         protected Options() {
             // noghing
         }
+
+        @Override
+        public String toString() {
+            return "Options [sessionId=" + sessionId + ", name=" + name + ", propertiesPath=" + propertiesPath + "]";
+        }
     }
 
     public static void main(final String[] args) {
@@ -75,6 +81,17 @@ public class SuggestCreator implements Serializable {
             return;
         }
 
+        if (logger.isDebugEnabled()) {
+            try {
+                ManagementFactory.getRuntimeMXBean().getInputArguments().stream().forEach(s -> logger.debug("Parameter: " + s));
+                System.getProperties().entrySet().stream().forEach(e -> logger.debug("Property: " + e.getKey() + "=" + e.getValue()));
+                System.getenv().entrySet().forEach(e -> logger.debug("Env: " + e.getKey() + "=" + e.getValue()));
+                logger.debug("Option: " + options);
+            } catch (Exception e) {
+                // ignore
+            }
+        }
+
         final String transportAddresses = System.getProperty(Constants.FESS_ES_TRANSPORT_ADDRESSES);
         if (StringUtil.isNotBlank(transportAddresses)) {
             System.setProperty(EsClient.TRANSPORT_ADDRESSES, transportAddresses);