java.lang.Object
com.github.toolarium.jwebserver.logger.logback.LogbackUtil

public final class LogbackUtil extends Object
Logback utitlity
  • Method Details

    • getInstance

      public static LogbackUtil getInstance()
      Get the instance
      Returns:
      the instance
    • enableVerbose

      public void enableVerbose()
      Enable verbose mode
    • detachAppender

      public void detachAppender(String appenderName)
      Detach appender
      Parameters:
      appenderName - the appender name
    • createAccessLogAppender

      public org.slf4j.Logger createAccessLogAppender(String appenderName, String filePattern)
      Create logger with an own appender
      Parameters:
      appenderName - the name of the appender
      filePattern - the file pattern, e.g. "logs/access-%d{yyyy-MM-dd}.log.gz"
      Returns:
      the logger
    • createAccessLogAppender

      public org.slf4j.Logger createAccessLogAppender(String appenderName, String filePattern, Integer maxHistory, String inputMaxFileSize, String inputTotalSize)
      Create logger with an own appender
      Parameters:
      appenderName - the name of the appender
      filePattern - the file pattern, e.g. "logs/access-%d{yyyy-MM-dd}.log.gz"
      maxHistory - the max history
      inputMaxFileSize - the max file size, e.g. 100MB
      inputTotalSize - the total size, e.g. 100GB
      Returns:
      the logger
    • createLogAppender

      public org.slf4j.Logger createLogAppender(String appenderName, String linePattern, String filePattern, Integer maxHistory, boolean appendFile, String inputMaxFileSize, String inputTotalSize)
      Create logger with an own appender
      Parameters:
      appenderName - the name of the appender
      linePattern - the log line pattern, e.g. %-30(%d{ISO8601} - %1.-1level - %-6.6t{5}) - %-100.100(%logger#%M:%L){99} | %msg%n
      filePattern - the file pattern, e.g. "%d{yyyy-MM-dd}.%i.log"
      maxHistory - the max history
      appendFile - true to append file
      inputMaxFileSize - the max file size, e.g. 100MB
      inputTotalSize - the total size, e.g. 100GB
      Returns:
      the logger
    • createLogAppender

      public org.slf4j.Logger createLogAppender(String appenderName, String linePattern, String filePattern, Integer maxHistory, boolean appendFile, ch.qos.logback.core.util.FileSize maxFileSize, ch.qos.logback.core.util.FileSize totalSize)
      Create logger with an own appender
      Parameters:
      appenderName - the name of the appender
      linePattern - the log line pattern, e.g. %-30(%d{ISO8601} - %1.-1level - %-6.6t{5}) - %-100.100(%logger#%M:%L){99} | %msg%n
      filePattern - the file pattern, e.g. "%d{yyyy-MM-dd}.%i.log"
      maxHistory - the max history
      appendFile - true to append file
      maxFileSize - the max file size
      totalSize - the total size
      Returns:
      the logger
    • getLogger

      public ch.qos.logback.classic.Logger getLogger(String name)
      Get logback logger instance
      Parameters:
      name - the logger
      Returns:
      the logger instance