diff --git a/src/main/java/org/codelibs/fess/Constants.java b/src/main/java/org/codelibs/fess/Constants.java index 13e53af7f..2d226ec0e 100644 --- a/src/main/java/org/codelibs/fess/Constants.java +++ b/src/main/java/org/codelibs/fess/Constants.java @@ -427,4 +427,6 @@ public class Constants extends CoreLibConstants { public static final String FESS_THUMBNAIL_PATH = "fess.thumbnail.path"; public static final String FESS_VAR_PATH = "fess.var.path"; + + public static final String FESS_LOG_LEVEL = "fess.log.level"; } diff --git a/src/main/java/org/codelibs/fess/app/web/admin/general/AdminGeneralAction.java b/src/main/java/org/codelibs/fess/app/web/admin/general/AdminGeneralAction.java index ca220797d..0034031a6 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/general/AdminGeneralAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/general/AdminGeneralAction.java @@ -168,6 +168,10 @@ public class AdminGeneralAction extends FessAdminAction { fessConfig.storeSystemProperties(); ComponentUtil.getLdapManager().updateConfig(); ComponentUtil.getSystemHelper().refreshDesignJspFiles(); + + if (StringUtil.isNotBlank(form.logLevel)) { + ComponentUtil.getSystemHelper().setLogLevel(form.logLevel); + } } public static void updateForm(final FessConfig fessConfig, final EditForm form) { @@ -209,6 +213,7 @@ public class AdminGeneralAction extends FessAdminAction { form.ldapMemberofAttribute = fessConfig.getLdapMemberofAttribute(); form.notificationLogin = fessConfig.getNotificationLogin(); form.notificationSearchTop = fessConfig.getNotificationSearchTop(); + form.logLevel = ComponentUtil.getSystemHelper().getLogLevel().toUpperCase(); } private void updateProperty(final String key, final String value) { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/general/EditForm.java b/src/main/java/org/codelibs/fess/app/web/admin/general/EditForm.java index 58eee6b2f..909374122 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/general/EditForm.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/general/EditForm.java @@ -156,4 +156,7 @@ public class EditForm { @Size(max = 3000) public String notificationSearchTop; + + @Size(max = 10) + public String logLevel; } diff --git a/src/main/java/org/codelibs/fess/helper/SystemHelper.java b/src/main/java/org/codelibs/fess/helper/SystemHelper.java index a82a940a7..65d0f60c8 100644 --- a/src/main/java/org/codelibs/fess/helper/SystemHelper.java +++ b/src/main/java/org/codelibs/fess/helper/SystemHelper.java @@ -48,6 +48,8 @@ import javax.servlet.ServletContext; import org.apache.commons.lang3.LocaleUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; import org.codelibs.core.lang.StringUtil; import org.codelibs.core.misc.Pair; import org.codelibs.fess.Constants; @@ -455,6 +457,18 @@ public class SystemHelper { return response; } + 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); + } + + public String getLogLevel() { + return System.getProperty(Constants.FESS_LOG_LEVEL, Level.WARN.toString()); + } + public String getVersion() { return version; } diff --git a/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java b/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java index f9705e434..c2683f49c 100644 --- a/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java +++ b/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java @@ -242,6 +242,9 @@ public class FessLabels extends UserMessages { /** The key of the message: Purge By Bots */ public static final String LABELS_PURGE_BY_BOTS = "{labels.purgeByBots}"; + /** The key of the message: Log Level */ + public static final String LABELS_LOG_LEVEL = "{labels.logLevel}"; + /** The key of the message: Purge Search Log */ public static final String LABELS_PURGE_SEARCH_LOG_DAY = "{labels.purgeSearchLogDay}"; @@ -1208,6 +1211,9 @@ public class FessLabels extends UserMessages { /** The key of the message: Bots Name For Purge */ public static final String LABELS_purge_by_bots = "{labels.purge_by_bots}"; + /** The key of the message: Log Level */ + public static final String LABELS_log_level = "{labels.log_level}"; + /** The key of the message: Encoding for CSV */ public static final String LABELS_csv_file_encoding = "{labels.csv_file_encoding}"; diff --git a/src/main/resources/fess_label.properties b/src/main/resources/fess_label.properties index a9a311a63..5956f2322 100644 --- a/src/main/resources/fess_label.properties +++ b/src/main/resources/fess_label.properties @@ -70,6 +70,7 @@ labels.num=Num labels.pn=Page Number labels.protocolScheme=Scheme labels.purgeByBots=Purge By Bots +labels.logLevel=Log Level labels.purgeSearchLogDay=Purge Search Log labels.query=Query labels.queryId=Query ID @@ -394,6 +395,7 @@ labels.purge_search_log_day=Purge Search Log Before labels.purge_job_log_day=Purge Job Log Before labels.purge_user_info_day=Purge User Before labels.purge_by_bots=Bots Name For Purge +labels.log_level=Log Level labels.csv_file_encoding=Encoding for CSV labels.notification_to=Notification Email labels.pathmap_configuration=Path Mapping diff --git a/src/main/resources/fess_label_en.properties b/src/main/resources/fess_label_en.properties index e4e88d3de..d20f2804a 100644 --- a/src/main/resources/fess_label_en.properties +++ b/src/main/resources/fess_label_en.properties @@ -70,6 +70,7 @@ labels.num=Num labels.pn=Page Number labels.protocolScheme=Scheme labels.purgeByBots=Purge By Bots +labels.logLevel=Log Level labels.purgeSearchLogDay=Purge Search Log labels.query=Query labels.queryId=Query ID @@ -394,6 +395,7 @@ labels.purge_search_log_day=Purge Search Log Before labels.purge_job_log_day=Purge Job Log Before labels.purge_user_info_day=Purge User Before labels.purge_by_bots=Bots Name For Purge +labels.log_level=Log Level labels.csv_file_encoding=Encoding for CSV labels.notification_to=Notification Email labels.pathmap_configuration=Path Mapping diff --git a/src/main/resources/fess_label_ja.properties b/src/main/resources/fess_label_ja.properties index 61740471f..07205e2bc 100644 --- a/src/main/resources/fess_label_ja.properties +++ b/src/main/resources/fess_label_ja.properties @@ -70,6 +70,7 @@ labels.num=数 labels.pn=ページ番号 labels.protocolScheme=スキーム labels.purgeByBots=Botsの削除 +labels.logLevel=ログレベル labels.purgeSearchLogDay=検索ログの削除 labels.query=クエリー labels.queryId=クエリーID @@ -386,6 +387,7 @@ labels.purge_search_log_day=以前の検索ログを削除 labels.purge_job_log_day=以前のジョブログを削除 labels.purge_user_info_day=以前のユーザーログを削除 labels.purge_by_bots=ログを削除するボット名 +labels.log_level=ログレベル labels.csv_file_encoding=CSVファイルのエンコード labels.notification_to=通知メール labels.pathmap_configuration=パスマッピング diff --git a/src/main/webapp/WEB-INF/view/admin/general/admin_general.jsp b/src/main/webapp/WEB-INF/view/admin/general/admin_general.jsp index 87c193990..b786f19d6 100644 --- a/src/main/webapp/WEB-INF/view/admin/general/admin_general.jsp +++ b/src/main/webapp/WEB-INF/view/admin/general/admin_general.jsp @@ -303,6 +303,23 @@ +
+ +
+ + + OFF + FATAL + ERROR + WARN + INFO + DEBUG + TRACE + ALL + +
+
<%-- Suggest --%>