Bladeren bron

fix #2293 add logging.app.packages

Shinsuke Sugaya 5 jaren geleden
bovenliggende
commit
c6b1b57d94

+ 2 - 3
src/main/java/org/codelibs/fess/helper/SystemHelper.java

@@ -491,9 +491,8 @@ public class SystemHelper {
     public void setLogLevel(final String level) {
         final Level logLevel = Level.toLevel(level, Level.WARN);
         System.setProperty(Constants.FESS_LOG_LEVEL, logLevel.toString());
-        Configurator.setLevel("org.codelibs.fess", logLevel);
-        Configurator.setLevel("org.dbflute", logLevel);
-        Configurator.setLevel("org.lastaflute", logLevel);
+        stream(ComponentUtil.getFessConfig().getLoggingAppPackages(), ",").of(
+                stream -> stream.map(String::trim).filter(StringUtil::isNotEmpty).forEach(s -> Configurator.setLevel(s, logLevel)));
     }
 
     public String getLogLevel() {

+ 15 - 0
src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java

@@ -959,6 +959,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
     /** The key of the configuration. e.g. filetype,created,click_count,title,doc_id,url,score,site,filename,host,digest,boost,mimetype,favorite_count,_id,lang,last_modified,content_length,timestamp */
     String LOGGING_SEARCH_DOCS_FIELDS = "logging.search.docs.fields";
 
+    /** The key of the configuration. e.g. org.codelibs,org.dbflute,org.lastaflute */
+    String LOGGING_APP_PACKAGES = "logging.app.packages";
+
     /** The key of the configuration. e.g. 4000 */
     String FORM_ADMIN_MAX_INPUT_SIZE = "form.admin.max.input.size";
 
@@ -4320,6 +4323,13 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
      */
     String getLoggingSearchDocsFields();
 
+    /**
+     * Get the value for the key 'logging.app.packages'. <br>
+     * The value is, e.g. org.codelibs,org.dbflute,org.lastaflute <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     */
+    String getLoggingAppPackages();
+
     /**
      * Get the value for the key 'form.admin.max.input.size'. <br>
      * The value is, e.g. 4000 <br>
@@ -7734,6 +7744,10 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             return get(FessConfig.LOGGING_SEARCH_DOCS_FIELDS);
         }
 
+        public String getLoggingAppPackages() {
+            return get(FessConfig.LOGGING_APP_PACKAGES);
+        }
+
         public String getFormAdminMaxInputSize() {
             return get(FessConfig.FORM_ADMIN_MAX_INPUT_SIZE);
         }
@@ -9100,6 +9114,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             defaultMap
                     .put(FessConfig.LOGGING_SEARCH_DOCS_FIELDS,
                             "filetype,created,click_count,title,doc_id,url,score,site,filename,host,digest,boost,mimetype,favorite_count,_id,lang,last_modified,content_length,timestamp");
+            defaultMap.put(FessConfig.LOGGING_APP_PACKAGES, "org.codelibs,org.dbflute,org.lastaflute");
             defaultMap.put(FessConfig.FORM_ADMIN_MAX_INPUT_SIZE, "4000");
             defaultMap.put(FessConfig.FORM_ADMIN_LABEL_IN_CONFIG_ENABLED, "false");
             defaultMap.put(FessConfig.AUTHENTICATION_ADMIN_USERS, "admin");

+ 1 - 0
src/main/resources/fess_config.properties

@@ -542,6 +542,7 @@ index.backup.log.targets=click_log.ndjson,favorite_log.ndjson,search_log.ndjson,
 # logging
 logging.search.docs.enabled=true
 logging.search.docs.fields=filetype,created,click_count,title,doc_id,url,score,site,filename,host,digest,boost,mimetype,favorite_count,_id,lang,last_modified,content_length,timestamp
+logging.app.packages=org.codelibs,org.dbflute,org.lastaflute
 
 # ========================================================================================
 #                                                                                     Web