Oracle Application Server Java Object Cache API Reference
10g Release 2 (10.1.2)

B14018-02


oracle.ias.cache
Class CacheLogger

java.lang.Object
  extended byoracle.ias.cache.CacheLogger

Direct Known Subclasses:
DefaultCacheLogger

public abstract class CacheLogger
extends java.lang.Object

CacheLogger is an abstract class. Application can extend this class to implement a customized logging mechanism. The caching service uses this API to log cache related messages. User can use Cache.setLogSeverity(int) to change the desirable cache logging severity. The severities are defined in this class.

A default cache logger is implemented, if no cache logger is provided, the default cache logger will be used. By default, DefaultCacheLogger will log all the messages to a file called "javacache.log" in the directory where the server process started. Users can set a different log file name for the default logger when initializes the cache by calling CacheAttributes.setLogFileName(String).

Since:
2.0.0
Version:
2.0.0 07/12/00
See Also:
setLogFileName, DefaultCacheLogger

Field Summary
static int DEBUG
           
static int DEFAULT
           
static int ERROR
           
static int FATAL
           
static int INFO
           
protected  java.lang.String logFileName
           
static int OFF
           
protected  int severity
          sets the logging severity.
static int TRACE
           
static int WARNING
           

 

Constructor Summary
CacheLogger()
           

 

Method Summary
abstract  void flush()
          flush will write out the log messages, and clean the logging buffer.
 java.lang.String getLogFileName()
          returns the log file name defined as logFileName in this class.
 int getSeverity()
          returns the severity level defined as severity in this class.
abstract  void init(java.lang.String fileName, int severity)
          is called by the cache when the logging system is initialized.
abstract  void log(java.lang.String message)
          is an abstract method.
abstract  void log(java.lang.String message, java.lang.Throwable cause)
          is an abstract method.
static int parseLogSeverity(java.lang.String name)
          Parse the severity level
 void setSeverity(int sev)
          changes the severity level defined as severity in this class.
static java.lang.String severityToString(int sev)
          Translate severity into String format
 boolean shouldLog(int sever)
          returns true if the severity level is such that the message should be logged.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

OFF

public static final int OFF
See Also:
Constant Field Values

FATAL

public static final int FATAL
See Also:
Constant Field Values

ERROR

public static final int ERROR
See Also:
Constant Field Values

DEFAULT

public static final int DEFAULT
See Also:
Constant Field Values

WARNING

public static final int WARNING
See Also:
Constant Field Values

TRACE

public static final int TRACE
See Also:
Constant Field Values

INFO

public static final int INFO
See Also:
Constant Field Values

DEBUG

public static final int DEBUG
See Also:
Constant Field Values

severity

protected int severity
sets the logging severity. If Cache is initialized with a logger, The logger's severity will be used to decide if a cache's message should be logged or not. By doing so, cache can avoid formatting some messages if the system won't log it anyway. This value can be changed by either setSeverity or Cache.setLogSeverity(int) The log level from lower to higher is:

logFileName

protected java.lang.String logFileName

Constructor Detail

CacheLogger

public CacheLogger()

Method Detail

log

public abstract void log(java.lang.String message)
is an abstract method. Application writers can implement this method and provide a mechanism to log a string message.
Parameters:
message - the message need to be logged
Since:
2.0.0

log

public abstract void log(java.lang.String message,
                         java.lang.Throwable cause)
is an abstract method. Sub class should implement this method and provide a mechanism to log a string message and an object which implements the Throwable interface. This is mainly used to log exceptions.
Parameters:
message - The string message need to be logged
cause - An object implements the Throwable interface, usually, it is an exception.
Since:
2.0.0

flush

public abstract void flush()
flush will write out the log messages, and clean the logging buffer.
Since:
2.0.0

init

public abstract void init(java.lang.String fileName,
                          int severity)
                   throws CacheException
is called by the cache when the logging system is initialized. This method will set the initial logging severity and log file name.
Parameters:
fileName - The name of the file to log to
severity - The initial logging severity
Throws:
CacheException
Since:
2.0.0

getSeverity

public int getSeverity()
returns the severity level defined as severity in this class.
Returns:
the severity defined in this logger.
Since:
2.0.0

getLogFileName

public java.lang.String getLogFileName()
returns the log file name defined as logFileName in this class.
Returns:
the log file name defined in this logger.
Since:
2.0.0

shouldLog

public boolean shouldLog(int sever)
returns true if the severity level is such that the message should be logged.
Returns:
true if the severity level is such that the message should be logged.
Since:
2.0.0

setSeverity

public void setSeverity(int sev)
changes the severity level defined as severity in this class.
Parameters:
sev - the logging severity
Since:
2.0.0

parseLogSeverity

public static int parseLogSeverity(java.lang.String name)
Parse the severity level
Parameters:
name - to be parsed
Returns:
severity level

severityToString

public static java.lang.String severityToString(int sev)
Translate severity into String format
Parameters:
sev - is the log severity level
Returns:
the String format of the severity

Oracle Application Server Java Object Cache API Reference
10g Release 2 (10.1.2)

B14018-02


Copyright © 2004, 2005, Oracle. All rights reserved.