public class DefaultPersistitLogger extends Object implements PersistitLogger
Slf4jAdapter
Constructor and Description |
---|
DefaultPersistitLogger()
Construct a logger that logs messages at WARNING level or above to the
system console.
|
DefaultPersistitLogger(String fileName)
Construct a logger that logs messages to a file.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the log file.
|
void |
flush()
Writes pending I/O to the log file.
|
PersistitLevel |
getLevel() |
boolean |
isLoggable(PersistitLevel level)
Test whether a message at the specified level should be written to the
log.
|
void |
log(PersistitLevel level,
String message)
Writes a message to the log file and also displays high-significance
messages to
System.err . |
void |
open()
Prepares this logger to received messages.
|
void |
setLevel(PersistitLevel level) |
void |
setLevel(String levelName) |
public DefaultPersistitLogger()
public DefaultPersistitLogger(String fileName)
null
then log only WARNING and higher messages to
the system console.fileName
- Log file path namepublic void setLevel(String levelName)
public void setLevel(PersistitLevel level)
public PersistitLevel getLevel()
public void log(PersistitLevel level, String message)
System.err
.log
in interface PersistitLogger
level
- PersistitLevel at which this message should be logged.
(Ignored in this implementation.)message
- The message to writepublic boolean isLoggable(PersistitLevel level)
PersistitLogger
isLoggable
in interface PersistitLogger
level
- The level of the log eventpublic void open() throws Exception
open
in interface PersistitLogger
Exception
public void close() throws InterruptedException
close
in interface PersistitLogger
InterruptedException
public void flush()
BufferedWriter
, log messages may be held in memory rather
than being written to disk. Since the most interesting log messages in
the event of a failure are often the last messages, it is helpful for
these messages to be flushed to disk on a regular basis. This method is
invoked at various times within the execution of Persistit to increase
the likelihood that the log file will be useful in case the application
exits abruptly.flush
in interface PersistitLogger
Copyright © 2025 Open Identity Platform Community. All rights reserved.