com.sun.identity.log
Class Logger

java.lang.Object
  extended by java.util.logging.Logger
      extended by com.sun.identity.log.Logger

public class Logger
extends Logger

OpenSSO extension to the jdk1.4 Logger This extension gives some functionality required by OpenSSO secure logger. For JDK1.4 Logger please refer to

 http://java.sun.com/j2se/1.4.1/docs/api/java/util/logging/Logger.html
 


Field Summary
protected static boolean resolveHostName
           
static com.sun.identity.common.ReaderWriterLock rwLock
          Lock to prevent parallel writing and reading at the same time.
static ThreadLocal token
           
 
Constructor Summary
protected Logger(String name, String resourceBundleName)
          Protected method to construct a logger for a named subsystem.
 
Method Summary
 void flush()
          Writes all the buffered log records.
 String getCurrentFile()
          Returns the current file to which the logger's handler is writing.
static Logger getLogger(String name)
          Find or create a logger for a named subsystem.
static Logger getLogger(String name, String rbName)
          Find or create a logger for a named subsystem.
 void log(LogRecord record)
          Directs every log call to log(LogRecord, Object) And thus the default authorization check does not allow logging when an application uses this interface.
 void log(LogRecord record, Object cred)
          Calls super.log after checking authorization.
static boolean resolveHostNameEnabled()
          Return whether resolve host name is enabled
 void setCurrentFile(String fileName)
          Set the current file to which the logger's handler is writing.
 

Field Detail

token

public static ThreadLocal token

resolveHostName

protected static boolean resolveHostName

rwLock

public static com.sun.identity.common.ReaderWriterLock rwLock
Lock to prevent parallel writing and reading at the same time.

Constructor Detail

Logger

protected Logger(String name,
                 String resourceBundleName)
Protected method to construct a logger for a named subsystem.

The logger will be initially configured with a null Level and with useParentHandlers true.

Parameters:
name - A name for the logger. This should be a dot-separated name and should normally be based on the package name or class name of the subsystem, such as java.net or javax.swing. It may be null for anonymous Loggers.
resourceBundleName - Name of the ResourceBundle to be used for localizing messages for this logger. May be null if none of the messages require localization.
Throws:
MissingResourceException - if the ResourceBundleName is non-null and no corresponding resource can be found.
Method Detail

log

public void log(LogRecord record)
Directs every log call to log(LogRecord, Object) And thus the default authorization check does not allow logging when an application uses this interface.

Overrides:
log in class Logger
Parameters:
record - The LogRecord to be logged.

log

public void log(LogRecord record,
                Object cred)
Calls super.log after checking authorization. Data is not logged at all if this check fails.

Parameters:
record - The LogRecord to be logged.
cred - To prove authorization for log WRITE. The default authorization hook checks validity of the single sign on token which should be passed as the cred.

flush

public void flush()
Writes all the buffered log records.


getLogger

public static Logger getLogger(String name)
Find or create a logger for a named subsystem. If a logger has already been created with the given name it is returned. Otherwise a new logger is created.

If a new logger is created its log level will be configured based on the LogManager and it will be configured NOT to send logging output to its parent loggers Handlers. It will be registered in the LogManager global namespace.

Parameters:
name - A name for the logger. This should be a dot-separated name and should be the file name you want to have for your logs, such as amSSO.access, or audit.
Returns:
a suitable Logger.

getLogger

public static Logger getLogger(String name,
                               String rbName)
Find or create a logger for a named subsystem. If a logger has already been created with the given name it is returned. Otherwise a new logger is created.

If a new logger is created, its log level will be configured based on the LogManager and it will configured to also send logging output to its parent logger's Handlers. It will be registered in the LogManager global namespace.

If the named Logger already exists and does not yet have a localization resource bundle then the given resource bundle name is used. If the named Logger already exists and has a different resource bundle name then an IllegalArgumentException is thrown.

Parameters:
name - A name for the logger. This should be a dot-separated name and should be the file name you want to have for your logs, such as amSSO.access or audit.
rbName - A resource bundle to be used for localizing the log messages.
Returns:
logger for a named subsystem.

getCurrentFile

public String getCurrentFile()
Returns the current file to which the logger's handler is writing. This is useful only in case of file..

Returns:
the current file to which the logger's handler is writing.

setCurrentFile

public void setCurrentFile(String fileName)
Set the current file to which the logger's handler is writing.

Parameters:
fileName - name of file.

resolveHostNameEnabled

public static boolean resolveHostNameEnabled()
Return whether resolve host name is enabled

Returns:
resolveHostName