com.iplanet.portalserver.logging
Class LogManager

java.lang.Object
  |
  +--com.iplanet.portalserver.logging.LogManager

public class LogManager
extends java.lang.Object

This class provides the logging access methods for applications so that the applications can create, retrieve, submit, delete log information. It also provides a method to access a list of log names that have been created in the system by all the applications.


Field Summary
static java.lang.String DBDRIVER
          log database driver
static java.lang.String DBPASS
          log database pass
static java.lang.String DBUSER
          log database user
static java.lang.String LOCATION
          log location
static java.lang.String MAXFILESIZE
          log maximum file size, with minimum 100,000 bytes
static java.lang.String NUMHISTORYFILE
          number of history log
static java.lang.String READSIZE
          log read size, with minimum 3,000 bytes
static java.lang.String STATUS
          log status
static java.lang.String TYPE
          log type, ie, plain text or JDBC
 
Constructor Summary
LogManager(Session sess)
           
LogManager(SessionID sid)
           
LogManager(SessionID sid, java.lang.String server)
           
LogManager(Session sess, java.lang.String server)
           
 
Method Summary
 void create(java.lang.String logName)
          Create a log in the logging directory.
 void delete(java.lang.String logName)
          Delete a log from the system.
 java.util.Hashtable getLogAttrs(java.lang.String logName)
          Get log attributes from a log.
 java.util.Vector list()
          Get all the existing logs (history segments not included) from the system.
 java.util.Vector list(java.lang.String logName)
          Obtain a specific log segment list.
 java.util.Vector read(java.lang.String logName)
          Read log strings from a log.
 java.util.Vector read(java.lang.String logName, java.lang.String query)
          Retrieve log strings from a log with a query.
 java.util.List readLogRecord(java.lang.String logName)
          Read log records from a log.
 java.util.List readLogRecord(java.lang.String logName, java.lang.String query)
          Retrieve log records from a log with a query.
 void setLogAttrs(java.lang.String logName, java.util.Hashtable logattrs)
          Set log attributes for a log.
 void write(LogRecord lr, java.lang.String logName)
          Write a log record (key-value pair) information to a log.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS

public static final java.lang.String STATUS
log status

MAXFILESIZE

public static final java.lang.String MAXFILESIZE
log maximum file size, with minimum 100,000 bytes

LOCATION

public static final java.lang.String LOCATION
log location

NUMHISTORYFILE

public static final java.lang.String NUMHISTORYFILE
number of history log

TYPE

public static final java.lang.String TYPE
log type, ie, plain text or JDBC

DBDRIVER

public static final java.lang.String DBDRIVER
log database driver

DBUSER

public static final java.lang.String DBUSER
log database user

DBPASS

public static final java.lang.String DBPASS
log database pass

READSIZE

public static final java.lang.String READSIZE
log read size, with minimum 3,000 bytes
Constructor Detail

LogManager

public LogManager(Session sess)

LogManager

public LogManager(SessionID sid)

LogManager

public LogManager(Session sess,
                  java.lang.String server)

LogManager

public LogManager(SessionID sid,
                  java.lang.String server)
Method Detail

create

public void create(java.lang.String logName)
            throws LogException
Create a log in the logging directory. The default logging directory is /var/opt/SUNWwt/logs.
Parameters:
logName - A log to be created. A valid logName should not contain any "-".
Returns:
None.
Throws:
A - LogException is thrown if an error occurs as follows: Invalid session is encountered; The creating privilege is denied; or other fatal system errors are encountered;

write

public void write(LogRecord lr,
                  java.lang.String logName)
           throws LogException
Write a log record (key-value pair) information to a log. It allows an application to submit logging information to a log that application chooses.
Parameters:
logName - A log to which the application wants to submit a log record. It should be an valid and existing log name.
lr - A log record which contains key-value pair text message needed to be logged.
Returns:
None.
Throws:
A - LogException is thrown if it an error occurs as follows: Invalid session is encountered; The writing privilege is denied; The target log is in inactive status; The target log does not exist; or other fatal system errors are encountered;

read

public java.util.Vector read(java.lang.String logName,
                             java.lang.String query)
                      throws LogException
Retrieve log strings from a log with a query.
Parameters:
logName - A log from which the log information are retrieved. It should be valid and existing log name.
query - A query string. The keywords available to search on are "type", "domain", "loginid" "data" and "time". For the flat file based logging, one can give simple queries as follows: "time >= 2000/01/20"; "domain = sun.com"; "loginid = root"; "type = iwtAdmin"; if one is using DB logging, then one can give more complicated queries as the query string just gets used as the where criteria for the log read SQL. a few example query strings for Database logging might be "time > '2000/12/03 12:23:00 PST'" "loginid = 'root'" "domain like 'sun.com' and time > '2000/12/03 12:23:00 PST'" and other forms of SQL where clauses.
Returns:
A vector of strings, which includes information such as timestamps, domain names and login Id.
Throws:
A - LogException is thrown if it an error occurs as follows: Invalid session is encountered; The reading privilege is denied; The target log does not exist; or other fatal system errors are encountered;

read

public java.util.Vector read(java.lang.String logName)
                      throws LogException
Read log strings from a log.
Parameters:
logName - A log from which the log string are retrieved. It should be valid and existing log name.
Returns:
A vector of strings, which includes information such as timestamps, domain names and login Id.
Throws:
A - LogException is thrown if an error occurs as follows: Invalid session is encountered; The reading privilege is denied; The target log does not exist; or other fatal system errors are encountered;

readLogRecord

public java.util.List readLogRecord(java.lang.String logName)
                             throws LogException
Read log records from a log. It allows the appications to retrieve the log records(type and data pairs) they submitted to the flat file log.
Parameters:
logName - A log from which the log records are retrieved. It should be valid and existing log name.
Returns:
A list of log records containing type the log type and log message pair that the application/client submitted to the log.
Throws:
A - LogException is thrown if an error occurs as follows: Invalid session is encountered; The reading privilege is denied; The target log does not exist; or other fatal system errors are encountered;

readLogRecord

public java.util.List readLogRecord(java.lang.String logName,
                                    java.lang.String query)
                             throws LogException
Retrieve log records from a log with a query. It allows the applications to retrieve the log records(type and msg pairs) they submitted to the flat file log.
Parameters:
logName - A log from which the log records are retrieved. It should be valid and existing log name.
query - A query string. The keywords available to search on are "type", "domain", "loginid" "data" and "time". For the flat file based logging, one can give simple queries as follows: "time >= 2000/01/20"; "domain = sun.com"; "loginid = root"; "type = iwtAdmin"; If one is using DB logging, then one can give more complicated queries as the query string just gets used as the where criteria for the log read SQL. a few example query strings for Database logging might be "time > '2000/12/03 12:23:00 PST'" "loginid = 'root'" "domain like 'sun.com' and time > '2000/12/03 12:23:00 PST'" and other forms of SQL where clauses.
Returns:
A list of log records, which includes log type and data pair submitted by the applications.
Throws:
A - LogException is thrown if it an error occurs as follows: Invalid session is encountered; The reading privilege is denied; The target log does not exist; or other fatal system errors are encountered;

delete

public void delete(java.lang.String logName)
            throws LogException
Delete a log from the system.
Parameters:
logName - A log to be deleted. logName should be a valid and existing log name.
Returns:
None.
Throws:
A - LogException is thrown if an error occurs for the following reasons: Invalid session is encountered; The deleting privilege is denied; The target log does not exist; Deletion fails or other fatal system errors are encountered;

list

public java.util.Vector list()
                      throws LogException
Get all the existing logs (history segments not included) from the system.
Parameters:
None. -  
Returns:
A vector of all the logs in the system.
Throws:
A - LogException is thrown if an error occurs for the following reasons: Invalid session is encountered; The listing privilege is denied; The log list does not exist; or other fatal system errors are encountered;

list

public java.util.Vector list(java.lang.String logName)
                      throws LogException
Obtain a specific log segment list.
Parameters:
logName - A log name. It should be a valid and existing log name.
Returns:
A vector of the log segment list with segment indexs in sequence.
Throws:
A - LogException is thrown if an error occurs for the following reasons: Invalid session is encountered; The listing privilege is denied; The log segment list does not exist; or other fatal system errors are encountered;

getLogAttrs

public java.util.Hashtable getLogAttrs(java.lang.String logName)
                                throws LogException
Get log attributes from a log.
Parameters:
logName - A log from which the attributes are retrieved.
Returns:
A hashtable contains log attributes. The following are the logging attributes which have String values: Status ("ACTIVE" or "INACTIVE", "ACTIVE" is the default value); Max file size ("1000000" is the default value); Location ("/var/opt/SUNWwt/logs" is the default value); Number of history log ("3" is the default value); Logging type ("FILE" or "JDBC", and "FILE" is the default); Size of log reading ("100000" is the default value); Database user name; Database driver name ("oracle.jdbc.driver.OracleDriver" is the default). Database password;
Throws:
A - LogException is thrown if an error occurs as follows: Profile error is encountered; or other fatal system errors are encountered;

setLogAttrs

public void setLogAttrs(java.lang.String logName,
                        java.util.Hashtable logattrs)
                 throws LogException
Set log attributes for a log.
Parameters:
logName - A log to which the log attributes are set.
logattrs - A hashtable contains the following valid log attributes that can be passed in the Hashtable: Status ("ACTIVE" or "INACTIVE", "ACTIVE" is the default value); Max file size ("1000000" is the default value); Location ("/var/opt/SUNWwt/logs" is the default value); Number of history file ("3" is the default value); Logging type ("FILE" or "JDBC", and "FILE" is the default); Size of log reading ("100000" is the default value); Database user name; Database driver name ("oracle.jdbc.driver.OracleDriver" is the default). Database password;
Returns:
None.
Throws:
A - LogException is thrown if an error occurs as follows: Profile error is encountered; or other fatal system errors are encountered;