public class SecureFileHandler extends Handler
The FileHandler can either write to a specified file, or it can write to a rotating set of files.
For a archiving set of files, as each file reaches the limit ( LogConstants.MAX_FILE_SIZE), it is closed, archived, and a new file opened. Successively older files and named by adding a ".ddMMyyyyHHmmss" to the base filename. The Locking mechanism is much more relaxed(in JDK's FileHandler an exclusive lock is created on the file till the handler is closed which makes reading impossible)
Constructor and Description |
---|
SecureFileHandler(String fileName)
Creates a new SecureFileHandler.
|
Modifier and Type | Method and Description |
---|---|
static void |
addToCurrentFileList(String oldFileName,
String newFileName,
String logName)
Add new file name to the file list
|
void |
close()
Flush any buffered messages and Close all the files.
|
void |
flush()
Flush any buffered messages.
|
static Archiver |
getArchiver(String logName)
This method takes in a logger name and returns a archiver object
corresponding to that logger name.
|
static ArrayList |
getCurrentFileList(String logName)
Return the current file list for the logger.
|
static String |
getLoggerKeyName()
Return logger key name in associated key store
|
SecureLogHelper |
getSecureLogHelper()
Return secure logger helper instance
|
static SecureLogHelper |
getSecureLogHelper(String logName)
This method takes in a logger name and returns a helper object
corresponding to that logger name.
|
static SecureLogHelper |
getSecureLogHelperInst()
Returns SecureLogHelper instance
|
static String |
getTokenName()
Returns the token name used in the SecureLogHelper object.
|
void |
initializeKeyStore()
Initialize logger key store
|
static void |
initializeVerifier(AMPassword verPass,
Object token)
Initialize SecureLog verifier
|
void |
publish(LogRecord lrecord)
Format and publish a LogRecord.
|
static void |
resetCurrentFileList(String logName)
Reset the current file list for the logger.
|
static void |
setArchiver(String logName,
Archiver archiver)
This method is to set the archiver corresponding to a loggerName
|
void |
setEncoding(String encoding)
Set (or change) the character encoding used by this Handler.
|
static void |
setLoggerKeyName(String name)
Set logger key name in associated keystore
|
static void |
setLogPassword(AMPassword logPass,
Object token)
Set logger password
|
static void |
setTokenName(String tokenName)
Sets the token name to be used to initialize the SecureLogHelper object.
|
static void |
setVerPassword(AMPassword verPass,
Object token)
Sets verifier password.
|
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setErrorManager, setFilter, setFormatter, setLevel
public SecureFileHandler(String fileName)
fileName
- The filename associate with file handler.public void setEncoding(String encoding) throws SecurityException, UnsupportedEncodingException
setEncoding
in class Handler
encoding
- The name of a supported character encoding.
May be null, to indicate the default platform encoding.SecurityException
- if a security manager exists and if
the caller does not have LoggingPermission("control")
.UnsupportedEncodingException
- if the named encoding is
not supported.public void close()
public void publish(LogRecord lrecord)
This FileHandler is associated with a Formatter, which has to format the LogRecord according to ELF and return back the string formatted as per ELF. This method first checks if the header is already written to the file, if not, gets the header from the Formatter and writes it at the beginning of the file.
public static Archiver getArchiver(String logName)
logName
- a logger name associate with archiver objectpublic static void setArchiver(String logName, Archiver archiver)
logName
- the loggerName corresponding to a archiverarchiver
- the archiver corresponding to a loggerNamepublic static void setLogPassword(AMPassword logPass, Object token)
logPass
- the logger passwordtoken
- AM tokenpublic static void setVerPassword(AMPassword verPass, Object token)
verPass
- the verifier password.token
- AM tokenpublic static SecureLogHelper getSecureLogHelperInst()
public static SecureLogHelper getSecureLogHelper(String logName)
logName
- the logger name associate with helper object.public static void initializeVerifier(AMPassword verPass, Object token)
verPass
- verifier passwordtoken
- AM tokenpublic static void addToCurrentFileList(String oldFileName, String newFileName, String logName)
oldFileName
- old file name already exist.newFileName
- new file name needs to be added to file list.logName
- logger name for this file list.public static ArrayList getCurrentFileList(String logName)
logName
- Associated logger name for this file list.public static void resetCurrentFileList(String logName)
logName
- logName Associated logger name for this file list.public void initializeKeyStore()
public static void setTokenName(String tokenName)
tokenName
- the token name associate with logger key storepublic static String getTokenName()
public static void setLoggerKeyName(String name)
name
- the name of key in the key storepublic static String getLoggerKeyName()
public SecureLogHelper getSecureLogHelper()
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.