Class MockServerLogger

java.lang.Object
org.mockserver.logging.MockServerLogger

public class MockServerLogger extends Object
Author:
jamesdbloom
  • Constructor Details

    • MockServerLogger

      public MockServerLogger()
    • MockServerLogger

      public MockServerLogger(org.slf4j.Logger logger)
    • MockServerLogger

      public MockServerLogger(Configuration configuration, org.slf4j.Logger logger)
    • MockServerLogger

      public MockServerLogger(Class<?> loggerClass)
    • MockServerLogger

      public MockServerLogger(Configuration configuration, Class<?> loggerClass)
    • MockServerLogger

      public MockServerLogger(@Nullable HttpState httpStateHandler)
    • MockServerLogger

      public MockServerLogger(Configuration configuration, @Nullable HttpState httpStateHandler)
  • Method Details

    • configureLogger

      public static void configureLogger()
    • getConfiguration

      public Configuration getConfiguration()
      The Configuration this logger was constructed with, or null when it was built without one (test-support constructors, client-side use).

      Exposed because MockServerLogger is already the configuration carrier threaded through the whole matcher graph: matchers such as RegexStringMatcher, XPathMatcher and JsonStringMatcher — and the shared MatchingTimeoutExecutor — are constructed with a logger and nothing else, yet must honour instance-scoped matching limits (regexMatchingTimeoutMillis, xpathMatchingTimeoutMillis, customJsonUnitMatchersClass) that are settable over PUT /mockserver/configuration. Reading the configuration off the logger they already hold avoids threading a second parameter through ~15 matcher construction sites for values those sites never otherwise touch.

      Callers MUST treat null as "no instance configured" and fall back to ConfigurationProperties, exactly as isEnabledForInstance(Level) and isDisableLogging() already do.

    • setHttpStateHandler

      public MockServerLogger setHttpStateHandler(HttpState httpStateHandler)
    • setGlobalLogEventListener

      public static void setGlobalLogEventListener(Consumer<LogEntry> listener)
    • logEvent

      public void logEvent(LogEntry logEntry)
    • isEnabledForInstance

      public boolean isEnabledForInstance(org.slf4j.event.Level level)
    • isDisableLogging

      public boolean isDisableLogging()
    • writeToSystemOut

      public static void writeToSystemOut(org.slf4j.Logger logger, LogEntry logEntry, Configuration configuration)
    • writeToSystemOut

      public static void writeToSystemOut(org.slf4j.Logger logger, LogEntry logEntry)
    • isEnabled

      public static boolean isEnabled(org.slf4j.event.Level level)
    • isEnabled

      public static boolean isEnabled(org.slf4j.event.Level level, org.slf4j.event.Level configuredLevel)