From cee7d09e4086e8660ba9f5f58aaa4beb57dc89a4 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 2 May 2019 11:57:48 +0200 Subject: [PATCH] Add is*Enabled methods for log level checks to LogAccessor Closes gh-22862 --- .../springframework/core/log/LogAccessor.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/spring-core/src/main/java/org/springframework/core/log/LogAccessor.java b/spring-core/src/main/java/org/springframework/core/log/LogAccessor.java index 168f7f2c7e..b38223091a 100644 --- a/spring-core/src/main/java/org/springframework/core/log/LogAccessor.java +++ b/spring-core/src/main/java/org/springframework/core/log/LogAccessor.java @@ -68,6 +68,51 @@ public class LogAccessor { } + // Log level checks + + /** + * Is fatal logging currently enabled? + */ + public boolean isFatalEnabled() { + return this.log.isFatalEnabled(); + } + + /** + * Is error logging currently enabled? + */ + public boolean isErrorEnabled() { + return this.log.isErrorEnabled(); + } + + /** + * Is warn logging currently enabled? + */ + public boolean isWarnEnabled() { + return this.log.isWarnEnabled(); + } + + /** + * Is info logging currently enabled? + */ + public boolean isInfoEnabled() { + return this.log.isInfoEnabled(); + } + + /** + * Is debug logging currently enabled? + */ + public boolean isDebugEnabled() { + return this.log.isDebugEnabled(); + } + + /** + * Is trace logging currently enabled? + */ + public boolean isTraceEnabled() { + return this.log.isTraceEnabled(); + } + + // Plain log methods /**