Package com.sun.identity.log.handlers
Class DBHandler
- java.lang.Object
-
- java.util.logging.Handler
-
- com.sun.identity.log.handlers.DBHandler
-
public class DBHandler extends Handler
DBHandler takes log messages from the Logger and exports them to a specified Database. DBHandler reads LogManager's configuration to get information about Database userid, password, Database Driver, Database location. It takes from the caller the table name which will be created if it doesn't already exists.By default DBFormatter is used for formatting the logRecords.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Flush any buffered messages and close the current output stream.void
flush()
protected void
nonBlockingFlush()
Flush any buffered messages.void
publish(LogRecord logRecord)
Publishes the provided LogRecord.-
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
-
-
-
-
Constructor Detail
-
DBHandler
public DBHandler(String tableName)
Constructor takes the tableName as a parameter. Gets the configuration information from LogManager regarding the user name, password, database driver, the log location. Gets the formatter class from the configuration, loads it and sets it as default Formatter. Connects to the database using the username and password. If the table by that name doesnot exists, creates the table.- Parameters:
tableName
- Database table name for logger.
-
-
Method Detail
-
publish
public void publish(LogRecord logRecord)
Publishes the provided LogRecord.
-
nonBlockingFlush
protected void nonBlockingFlush()
Flush any buffered messages.
-
-