Class Slf4jLog
- All Implemented Interfaces:
LogInterface
LogInterface that routes every message to
SLF4J (the Simple Logging Facade for
Java). This lets MCPDBWizard software — and the JDBC code the wizard generates — log through
whatever SLF4J binding the host application already uses (Logback, Log4j 2, java.util.logging,
and so on) instead of MCPDBWizard's own file/console logs.
The five LogInterface severities map onto SLF4J levels as follows:
LogInterface | SLF4J |
|---|---|
debug | DEBUG |
info | INFO |
warning | WARN |
error | ERROR |
syserror | ERROR |
The isModal and isLogged flags carried by the detailed LogInterface
methods are accepted and ignored: SLF4J has no modal-dialog concept, and whether a message is
actually written is decided by the configured SLF4J backend's level filtering, not by this
class. Debug messages additionally honour GenericLog.debugOn() / GenericLog.debugOff() (off by
default), matching the other LogInterface implementations.
The exception-taking error/syserror methods pass the Throwable straight
to SLF4J, so the backend records the full stack trace rather than just the message text.
See LogInterface
Copyright 2003-2026 ATB Consultancy Services Ltd (formerly Orinda Software Ltd, Dublin, Ireland)
- Version:
- 7
- Author:
- devteam@mcpdbwizard.com
-
Field Summary
Fields inherited from class com.mcpdbwizard.pub.GenericLog
autoFlush, autoLog, debugMessagesPrinted, LOG_BEING_FLUSHED, printThreadIdFields inherited from interface com.mcpdbwizard.pub.LogInterface
DEBUG, DEFAULT_FIELD_DELIMITER, DEFAULT_FILENAME_DAY_FORMAT, DEFAULT_FILENAME_TIME_FORMAT, DEFAULT_TIME_FORMAT_STRING, ERROR, INFO, SYSERR, WARN -
Constructor Summary
ConstructorsConstructorDescriptionSlf4jLog()Create an instance ofSlf4jLogbacked by a logger named after this class.Create an instance ofSlf4jLogbacked by a logger named after the given class.Create an instance ofSlf4jLogbacked by a logger with the given name. -
Method Summary
Modifier and TypeMethodDescriptionvoidLog an error, passing the exception to SLF4J so the full stack trace is recorded.voidflush()Required byLogInterfacebut not used: SLF4J backends manage their own buffering and flushing.Returns the name of the SLF4J logger messages are routed through.voidLog a serious error, passing the exception to SLF4J so the full stack trace is recorded.protected voidwriteMessage(String messageType, String messageText, boolean isModal, boolean isLogged) Route a formatted message to the SLF4J level that corresponds to its severity.Methods inherited from class com.mcpdbwizard.pub.GenericLog
debug, debug, debugOff, debugOn, error, error, error, formatMessage, getDateFormat, getDebug, info, info, setAutoFlush, setAutoLog, syserror, syserror, syserror, warning, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.mcpdbwizard.pub.LogInterface
debug, debug, debugOff, debugOn, error, error, error, getDateFormat, getDebug, info, info, setAutoFlush, setAutoLog, syserror, syserror, syserror, warning, warning
-
Constructor Details
-
Slf4jLog
public Slf4jLog()Create an instance ofSlf4jLogbacked by a logger named after this class. -
Slf4jLog
Create an instance ofSlf4jLogbacked by a logger with the given name.- Parameters:
loggerName- the SLF4J logger name to use (for example a fully qualified class name or a functional category).
-
Slf4jLog
Create an instance ofSlf4jLogbacked by a logger named after the given class.- Parameters:
clazz- the class whose name is used as the SLF4J logger name.
-
-
Method Details
-
writeMessage
protected void writeMessage(String messageType, String messageText, boolean isModal, boolean isLogged) Route a formatted message to the SLF4J level that corresponds to its severity. The SLF4J backend applies its own level filtering, so a message emitted here may still be discarded downstream.- Specified by:
writeMessagein classGenericLog- Parameters:
messageType- one of theDEBUG,INFO,WARN,ERRORorSYSERRconstants defined inLogInterface.messageText- the message text.isModal- ignored; SLF4J has no modal-dialog concept.isLogged- ignored; the configured SLF4J backend decides what is written.
-
error
Log an error, passing the exception to SLF4J so the full stack trace is recorded.- Specified by:
errorin interfaceLogInterface- Overrides:
errorin classGenericLog- Parameters:
theException- the exception to log.isModal- ignored; SLF4J has no modal-dialog concept.isLogged- ignored; the configured SLF4J backend decides what is written.
-
syserror
Log a serious error, passing the exception to SLF4J so the full stack trace is recorded.- Specified by:
syserrorin interfaceLogInterface- Overrides:
syserrorin classGenericLog- Parameters:
theException- the exception to log.isModal- ignored; SLF4J has no modal-dialog concept.isLogged- ignored; the configured SLF4J backend decides what is written.
-
flush
public void flush()Required byLogInterfacebut not used: SLF4J backends manage their own buffering and flushing.- Specified by:
flushin interfaceLogInterface- Specified by:
flushin classGenericLog
-
getCurrentLog
Returns the name of the SLF4J logger messages are routed through.- Specified by:
getCurrentLogin interfaceLogInterface- Specified by:
getCurrentLogin classGenericLog- Returns:
- the SLF4J logger name (not a file path; the actual destination is determined by the SLF4J backend's configuration).
-