Class LogbackUtil
java.lang.Object
com.github.toolarium.jwebserver.logger.logback.LogbackUtil
Logback utitlity
-
Method Summary
Modifier and TypeMethodDescriptionorg.slf4j.LoggercreateAccessLogAppender(String appenderName, String filePattern) Create logger with an own appenderorg.slf4j.LoggercreateAccessLogAppender(String appenderName, String filePattern, Integer maxHistory, String inputMaxFileSize, String inputTotalSize) Create logger with an own appenderorg.slf4j.LoggercreateLogAppender(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 appenderorg.slf4j.LoggercreateLogAppender(String appenderName, String linePattern, String filePattern, Integer maxHistory, boolean appendFile, String inputMaxFileSize, String inputTotalSize) Create logger with an own appendervoiddetachAppender(String appenderName) Detach appendervoidEnable verbose modestatic LogbackUtilGet the instancech.qos.logback.classic.LoggerGet logback logger instance
-
Method Details
-
getInstance
Get the instance- Returns:
- the instance
-
enableVerbose
public void enableVerbose()Enable verbose mode -
detachAppender
Detach appender- Parameters:
appenderName- the appender name
-
createAccessLogAppender
Create logger with an own appender- Parameters:
appenderName- the name of the appenderfilePattern- 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 appenderfilePattern- the file pattern, e.g. "logs/access-%d{yyyy-MM-dd}.log.gz"maxHistory- the max historyinputMaxFileSize- the max file size, e.g. 100MBinputTotalSize- 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 appenderlinePattern- the log line pattern, e.g. %-30(%d{ISO8601} - %1.-1level - %-6.6t{5}) - %-100.100(%logger#%M:%L){99} | %msg%nfilePattern- the file pattern, e.g. "%d{yyyy-MM-dd}.%i.log"maxHistory- the max historyappendFile- true to append fileinputMaxFileSize- the max file size, e.g. 100MBinputTotalSize- 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 appenderlinePattern- the log line pattern, e.g. %-30(%d{ISO8601} - %1.-1level - %-6.6t{5}) - %-100.100(%logger#%M:%L){99} | %msg%nfilePattern- the file pattern, e.g. "%d{yyyy-MM-dd}.%i.log"maxHistory- the max historyappendFile- true to append filemaxFileSize- the max file sizetotalSize- the total size- Returns:
- the logger
-
getLogger
Get logback logger instance- Parameters:
name- the logger- Returns:
- the logger instance
-