Skip navigation links

Oracle Enterprise Scheduler Java API Reference
11g Release 1 (11.1.1.7)
E26229-06


oracle.as.scheduler.cp.file
Class LogFile

java.lang.Object
  extended by java.io.Writer
      extended by java.io.OutputStreamWriter
          extended by java.io.FileWriter
              extended by oracle.as.scheduler.cp.file.LogFile

All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class LogFile
extends java.io.FileWriter

This class is the entry point for logging for requests. It can be used to log messages to the request's log file that can then be reviewed by the user or system administrator. It must be noted that at this time, there can be only one log file per request.

Users can obtain access to this object by using the getLogFile method on the ProcessHelper class. Instantiating this class directly is forbidden and can cause undefined behavior.

Version:
$Header: ess/src/oracle/as/scheduler/cp/file/LogFile.java /st_ess_11.1.1.5.0pt/1 2012/08/21 15:59:32 sonelson Exp $
Author:
Ramkarthik Kalyanasundaram
See Also:
ProcessHelper

Field Summary
static int ALERT
          Alert messages.
static int CONFIG
          Configuration logging message.
static int EVENT
          High level logging messages.
static int EXCEPTION
          Used for internal errors that may have been raised/exceptions that were thrown, which the user may not have been notified directly of.
static int INFO
          INFO message
static int PROCEDURE
          Logging messages called upon entry and/or exit from a routine.
static int STATEMENT
          Low level logging messages giving maximum detail.
static int UNEXPECTED
          Highest level of severity - catch-all for any errors that were not expected (by the developer) to have occurred during normal execution.
static int USER_ERROR
          Messages at this level represent error messages the user might encounter.
static int USER_WARNING
          Warning messages displayed to an end user.

 

Fields inherited from class java.io.Writer
lock

 

Constructor Summary
LogFile(java.lang.String path, java.lang.String fileName, int logLevel)
           
LogFile(java.lang.String path, java.lang.String fileName, int logLevel, boolean aflogLevel)
          Create a new log file fileName in the directory/path specified by path with the log level set to logLevel.

 

Method Summary
 void close()
          Close this log file.
 int getCurrentLogLevel()
          Gets the current log level for the request that this log file is associated with.
 java.lang.String getFileName()
          Get the name of the file (without the path) that this object represents.
 boolean isWriteable()
          Check if the log file can be written to.
 void write(java.lang.String message)
          Write a string to the log file.
 void write(java.lang.String message, int level)
          Write a string to the log file.
 void writeln(java.lang.String message)
          Write a string to the log file along with a new line at the end of the string.
 void writeln(java.lang.String message, int level)
          Write a string to the log file along with a new line at the end of the string.

 

Methods inherited from class java.io.OutputStreamWriter
flush, getEncoding, write, write, write

 

Methods inherited from class java.io.Writer
append, append, append, write

 

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

 

Field Detail

ALERT

public static final int ALERT
Alert messages. This level is for the display of seeded message alerts.
See Also:
Constant Field Values

UNEXPECTED

public static final int UNEXPECTED
Highest level of severity - catch-all for any errors that were not expected (by the developer) to have occurred during normal execution.
See Also:
Constant Field Values

USER_ERROR

public static final int USER_ERROR
Messages at this level represent error messages the user might encounter. For example, something like "Duplicate key in index; cannot insert".
See Also:
Constant Field Values

EXCEPTION

public static final int EXCEPTION
Used for internal errors that may have been raised/exceptions that were thrown, which the user may not have been notified directly of. Example: "Networking routine XYZ could not connect; retrying."
See Also:
Constant Field Values

USER_WARNING

public static final int USER_WARNING
Warning messages displayed to an end user. ex. "You are about ready to delete a row."
See Also:
Constant Field Values

INFO

public static final int INFO
INFO message
See Also:
Constant Field Values

CONFIG

public static final int CONFIG
Configuration logging message.
See Also:
Constant Field Values

EVENT

public static final int EVENT
High level logging messages. Example: "User has chosen to Cancel the Purge operation."
See Also:
Constant Field Values

PROCEDURE

public static final int PROCEDURE
Logging messages called upon entry and/or exit from a routine. Example: "Entering routine validateLogin."
See Also:
Constant Field Values

STATEMENT

public static final int STATEMENT
Low level logging messages giving maximum detail. Example: "Copying string from buffer xyz to buffer zyx."
See Also:
Constant Field Values

Constructor Detail

LogFile

public LogFile(java.lang.String path,
               java.lang.String fileName,
               int logLevel,
               boolean aflogLevel)
        throws java.io.IOException
Create a new log file fileName in the directory/path specified by path with the log level set to logLevel.
Parameters:
path - directory where the file should be created
fileName - name of the log file to create
logLevel - the level at which messages should be logged to this file
Throws:
java.io.IOException - if an error occurs writing to the log file

LogFile

public LogFile(java.lang.String path,
               java.lang.String fileName,
               int logLevel)
        throws java.io.IOException
Throws:
java.io.IOException

Method Detail

getFileName

public java.lang.String getFileName()
Get the name of the file (without the path) that this object represents.
Returns:
the file name

getCurrentLogLevel

public int getCurrentLogLevel()
Gets the current log level for the request that this log file is associated with.
Returns:
the current log level as one of UNEXPECTED, ERROR, EXCEPTION, EVENT, PROCEDURE, STATEMENT or OFF

write

public void write(java.lang.String message,
                  int level)
           throws java.io.IOException
Write a string to the log file. If the level is greater than the current log level, the message is written to the file.
Parameters:
message - the message string
level - the level at which this message should be written.
Throws:
java.io.IOException - if an error occurs

writeln

public void writeln(java.lang.String message,
                    int level)
             throws java.io.IOException
Write a string to the log file along with a new line at the end of the string. If the level is greater than the current log level, the message is written to the file.
Parameters:
message - the message string
level - the level at which this message should be written.
Throws:
java.io.IOException - if an error occurs

write

public void write(java.lang.String message)
           throws java.io.IOException
Write a string to the log file. It is expected that the caller has already done the check for the current log level.
Overrides:
write in class java.io.Writer
Parameters:
message - the message string
Throws:
java.io.IOException - if an error occurs

writeln

public void writeln(java.lang.String message)
             throws java.io.IOException
Write a string to the log file along with a new line at the end of the string. It is expected that the caller has already done the check for the current log level.
Parameters:
message - the message string
Throws:
java.io.IOException - if an error occurs

close

public void close()
           throws java.io.IOException
Close this log file.
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStreamWriter
Throws:
java.io.IOException - if an error occurs while closing the file.

isWriteable

public boolean isWriteable()
Check if the log file can be written to. If it has been closed already this method returns false.
Returns:
if this file is writeable.

Skip navigation links

Oracle Enterprise Scheduler Java API Reference
11g Release 1 (11.1.1.7)
E26229-06


Copyright © 2008, 2013, Oracle and/or its affiliates. All rights reserved.