diff --git a/src/main/java/org/codelibs/fess/Constants.java b/src/main/java/org/codelibs/fess/Constants.java index 13e53af7f3dc14dc5956f8ac3557596439a1c762..2d226ec0e28001019999570a10cb942b56082038 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 ca220797dbf55179dc74be813195cddb6d4df12e..0034031a6a2c50df9f3e667af96d232490195d74 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 58eee6b2f3eec249d18b5a38d69173e9d218c5c2..909374122cb9e97d6df4c2f7510c1a03f519572b 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 a82a940a7259308802496712b784dd0dc2a69a5b..65d0f60c83e206f911f3e20df818f47ad889bedf 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 f9705e434d2190f65930164aeea9017fb815a02b..c2683f49c1aa04acaf65563844bc0552676e9bb0 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 a9a311a635597a92b1723fab17026b83cf9ddab4..5956f23221a349bc4ff2b6a0dd904835dcde8773 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 e4e88d3deef60a4fad7b480707b8e766b8890d6e..d20f2804a25cb2c909e305c48d266a8f78d37508 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 61740471f73752fe314b5e7ff940a67740fc8dd5..07205e2bc872a620dd006b3acf5b99ffe3f3fbed 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 87c1939907af792e3112c4d8a3a08bd608fbdb9b..b786f19d6b25a86b653ce7fa2d8a6152a2fc7c7e 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 --%>