Shinsuke Sugaya před 2 roky
rodič
revize
5a97261ce6

+ 1 - 1
src/main/java/org/codelibs/fess/job/CrawlJob.java

@@ -276,7 +276,7 @@ public class CrawlJob extends ExecJob {
         addSystemProperty(cmdList, Constants.FESS_CONF_PATH, null, null);
         cmdList.add("-Dfess." + getExecuteType() + ".process=true");
         cmdList.add("-Dfess.log.path=" + (logFilePath != null ? logFilePath : systemHelper.getLogFilePath()));
-        addSystemProperty(cmdList, "fess.log.name", "fess-" + getExecuteType(), "-" + getExecuteType());
+        addSystemProperty(cmdList, "fess.log.name", getLogName("fess"), getLogName(StringUtil.EMPTY));
         if (logLevel == null) {
             addSystemProperty(cmdList, "fess.log.level", null, null);
         } else {

+ 15 - 0
src/main/java/org/codelibs/fess/job/ExecJob.java

@@ -27,6 +27,7 @@ import java.util.Properties;
 import org.apache.commons.io.FileUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+import org.codelibs.core.lang.StringUtil;
 import org.codelibs.core.timer.TimeoutManager;
 import org.codelibs.core.timer.TimeoutTask;
 import org.codelibs.fess.Constants;
@@ -49,6 +50,8 @@ public abstract class ExecJob {
 
     protected String logLevel;
 
+    protected String logSuffix = StringUtil.EMPTY;
+
     protected List<String> jvmOptions = new ArrayList<>();
 
     protected String lastaEnv;
@@ -86,6 +89,11 @@ public abstract class ExecJob {
         return this;
     }
 
+    public ExecJob logSuffix(final String logSuffix) {
+        this.logSuffix = logSuffix.trim().replaceAll("\\s", "_");
+        return this;
+    }
+
     public ExecJob timeout(final int timeout) {
         this.timeout = timeout;
         return this;
@@ -196,4 +204,11 @@ public abstract class ExecJob {
             throw new IORuntimeException(e);
         }
     }
+
+    protected String getLogName(final String logPrefix) {
+        if (logSuffix.length() > 0) {
+            return logPrefix + "-" + getExecuteType() + "-" + logSuffix;
+        }
+        return logPrefix + "-" + getExecuteType();
+    }
 }

+ 1 - 1
src/main/java/org/codelibs/fess/job/GenerateThumbnailJob.java

@@ -172,7 +172,7 @@ public class GenerateThumbnailJob extends ExecJob {
         cmdList.add("-Dfess.log.path=" + logFilePath);
         addSystemProperty(cmdList, Constants.FESS_VAR_PATH, null, null);
         addSystemProperty(cmdList, Constants.FESS_THUMBNAIL_PATH, null, null);
-        addSystemProperty(cmdList, "fess.log.name", "fess-" + getExecuteType(), "-" + getExecuteType());
+        addSystemProperty(cmdList, "fess.log.name", getLogName("fess"), getLogName(StringUtil.EMPTY));
         if (logLevel != null) {
             cmdList.add("-Dfess.log.level=" + logLevel);
         }

+ 1 - 1
src/main/java/org/codelibs/fess/job/SuggestJob.java

@@ -157,7 +157,7 @@ public class SuggestJob extends ExecJob {
             logFilePath = value != null ? value : new File(targetDir, "logs").getAbsolutePath();
         }
         cmdList.add("-Dfess.log.path=" + logFilePath);
-        addSystemProperty(cmdList, "fess.log.name", "fess-" + getExecuteType(), "-" + getExecuteType());
+        addSystemProperty(cmdList, "fess.log.name", getLogName("fess"), getLogName(StringUtil.EMPTY));
         if (logLevel == null) {
             addSystemProperty(cmdList, "fess.log.level", null, null);
         } else {