Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.ifs.utils.io
Class Log

    java.lang.Object
      oracle.ifs.utils.io.Log

    public class Log

extends java.lang.Object

The Log class provides a basic logging mechanism. Each application can obtain a single instance of the Log class, representing the default or primary log, by invoking the `get` method. In this way, any portion of the application can use logging without having to pass around a reference to the primary Log.

Note: Applications can use the constructor if they require another Log instance.

The following sample code provides an example of how applications can use the Log class:

     // get logfile from app properties
     String logfile = "myLogFile";
     Log.get().setOutput(new FileOutputStream(logfile));
     Log.get().setLoggingLevel(Log.ADMIN_LEVEL);

     // setup on-screen tracing in addition to logging
     Log.get().setTeeOutput(System.out);

     try
     {
       // create a user session
     }
     catch (IfsException ifse)
     {
       Log.get().println("Invalid user credential", Log.USER_LEVEL);
       Log.get().printStackTrace(ifse, Log.DEBUG_LEVEL);
     }

Field Summary
`static int` | `ADMIN_LEVEL` ADMIN logging level: displays messages from the USER logging level as well as warning messages.
`static int` | `DEBUG_LEVEL` DEBUG logging level: displays messages from the ADMIN logging level as well as informational and debugging messages.
`static int` | `USER_LEVEL` USER logging level: displays critical messages and errors.

Constructor Summary
`Log()` Creates a new Log instance.

Method Summary
`void` | `dispose()`
`static Log` | `get()` Returns the shared Log instance.
`int` | `getLoggingLevel()` Returns the logging level for this Log.
`java.io.PrintWriter` | `getOutput()` Returns this Log's primary output.
`java.io.PrintWriter` | `getTeeOutput()` Returns this Log's secondary output.
`boolean` | `isLogged(int level)`
`void` | `log(int level, java.lang.String prefix, java.lang.String message)`
`void` | `log(int level, java.lang.String prefix, java.lang.String message, java.lang.Throwable t)`
`void` | `log(int level, java.lang.String message, java.lang.Throwable t)`
`void` | `log(java.lang.Object message)` Calls println(Object).
`void` | `log(java.lang.Object message, boolean tagTimestamp)` Calls println(Object, boolean).
`void` | `log(java.lang.Object message, boolean tagTimestamp, int level)` Calls println(Object, boolean, int).
`void` | `log(java.lang.Object message, int level)` Calls println(Object, booelan int).
`void` | `logTimestamp()` Calls printlnTimestamp.
`void` | `print(java.lang.Object object)` Prints the string representation of the given object without a newline.
`void` | `print(java.lang.Object message, boolean tagTimestamp)` Prints an optionally timestamped message to the log without printing a newline.
`void` | `print(java.lang.Object message, boolean tagTimestamp, int level)` Prints an optionally timestamped message to the log without printing a newline.
`void` | `println()` Prints a newline to the log.
`void` | `println(java.lang.Object object)` Prints the string representation of the given object and a newline.
`void` | `println(java.lang.Object message, boolean tagTimestamp)` Prints an optionally timestamped message and newline to the log.
`void` | `println(java.lang.Object message, boolean tagTimestamp, int level)` Prints an optionally timestamped message and newline to the log.
`void` | `printlnTimestamp()` Prints a timestamp and newline to the log.
`void` | `printStackTrace(java.lang.Throwable t)` Prints a stack trace to the log.
`void` | `printStackTrace(java.lang.Throwable t, int level)` Prints a stack trace to the log.
`void` | `printTimestamp()` Prints a timestamp to the log without printing a newline.
`void` | `processLog(LogProcesser logProcesser)` Perform a "long or complex" operation on the log file
`void` | `setDateFormat(java.text.DateFormat format)` Sets the DateFormat used for timestamps.
`void` | `setLoggingLevel(int level)` Sets the logging level for this Log.
`void` | `setLogLevel(int level)`
`void` | `setOutput(java.io.PrintStream out)` Sets this Log's primary output.
`void` | `setOutput(java.io.PrintWriter writer)` Sets this Log's primary output.
`void` | `setTeeOutput(java.io.PrintStream out)` Sets this Log's secondary output.
`void` | `setTeeOutput(java.io.PrintWriter writer)` Sets this Log's secondary output.
`void` | `swapLog(java.lang.String logFileName, java.lang.String tempName, java.lang.String backupName)` Swap the log file so we can start using a new one

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

Field Detail

### USER_LEVEL

    public static final int USER_LEVEL

  Description copied from class: `Log`
  USER logging level: displays critical messages and errors.

  See Also:
    Constant Field Values

### ADMIN_LEVEL

    public static final int ADMIN_LEVEL

  Description copied from class: `Log`
  ADMIN logging level: displays messages from the USER logging level as well as warning messages.

  See Also:
    Constant Field Values

### DEBUG_LEVEL

    public static final int DEBUG_LEVEL

  Description copied from class: `Log`
  DEBUG logging level: displays messages from the ADMIN logging level as well as informational and debugging messages.

  See Also:
    Constant Field Values

Constructor Detail

### Log

    public Log()

  Creates a new Log instance.

Method Detail

### get

    public static Log get()

  Description copied from class: `Log`
  Returns the shared Log instance.

### setDateFormat

    public void setDateFormat(java.text.DateFormat format)

  Description copied from class: `Log`
  Sets the DateFormat used for timestamps.

### getOutput

    public java.io.PrintWriter getOutput()

  Description copied from class: `Log`
  Returns this Log's primary output.

  Returns:
    the PrintWriter where this Log's output is being sent.

### setOutput

    public void setOutput(java.io.PrintWriter writer)

  Description copied from class: `Log`
  Sets this Log's primary output.

  Parameters:
    `writer` - the PrintWriter where this Log's output will be sent.

### setOutput

    public void setOutput(java.io.PrintStream out)

  Description copied from class: `Log`
  Sets this Log's primary output.

  Parameters:
    `out` - the PrintStream where this Log's output will be sent (usually System.out).

### getTeeOutput

    public java.io.PrintWriter getTeeOutput()

  Description copied from class: `Log`
  Returns this Log's secondary output.

  Returns:
    the PrintWriter where this Log's output is being sent.

### setTeeOutput

    public void setTeeOutput(java.io.PrintWriter writer)

  Description copied from class: `Log`
  Sets this Log's secondary output.

  Parameters:
    `writer` - the PrintWriter where this Log's output will be sent.

### setTeeOutput

    public void setTeeOutput(java.io.PrintStream out)

  Description copied from class: `Log`
  Sets this Log's secondary output.

  Parameters:
    `out` - the PrintStream where this Log's output will be sent (usually System.out).

### getLoggingLevel

    public int getLoggingLevel()

  Description copied from class: `Log`
  Returns the logging level for this Log.

  Returns:
    the logging level for this Log.

### setLoggingLevel

    public void setLoggingLevel(int level)

  Description copied from class: `Log`
  Sets the logging level for this Log.

  Parameters:
    `level` - a logging level constant: USER_LEVEL, ADMIN_LEVEL, or DEBUG_LEVEL.

### log

    public void log(java.lang.Object message)

  Description copied from class: `Log`
  Calls println(Object).

### log

    public void log(java.lang.Object message,
                    boolean tagTimestamp)

  Description copied from class: `Log`
  Calls println(Object, boolean).

### log

    public void log(java.lang.Object message,
                    int level)

  Description copied from class: `Log`
  Calls println(Object, booelan int).

### log

    public void log(java.lang.Object message,
                    boolean tagTimestamp,
                    int level)

  Description copied from class: `Log`
  Calls println(Object, boolean, int).

### logTimestamp

    public void logTimestamp()

  Description copied from class: `Log`
  Calls printlnTimestamp.

### printTimestamp

    public void printTimestamp()

  Description copied from class: `Log`
  Prints a timestamp to the log without printing a newline.

### printlnTimestamp

    public void printlnTimestamp()

  Description copied from class: `Log`
  Prints a timestamp and newline to the log.

### printStackTrace

    public void printStackTrace(java.lang.Throwable t)

  Description copied from class: `Log`
  Prints a stack trace to the log.

  Parameters:
    `t` - the Throwable whose stack trace to print.

### printStackTrace

    public void printStackTrace(java.lang.Throwable t,
                                int level)

  Description copied from class: `Log`
  Prints a stack trace to the log.

  Parameters:
    `t` - the Throwable whose stack trace to print.
    `level` - the logging level for this message.

### print

    public void print(java.lang.Object object)

  Description copied from class: `Log`
  Prints the string representation of the given object without a newline.

### println

    public void println()

  Description copied from class: `Log`
  Prints a newline to the log.

### println

    public void println(java.lang.Object object)

  Description copied from class: `Log`
  Prints the string representation of the given object and a newline.

### print

    public void print(java.lang.Object message,
                      boolean tagTimestamp)

  Description copied from class: `Log`
  Prints an optionally timestamped message to the log without printing a newline.

  Parameters:
    `message` - the message to print.
    `tagTimestamp` - true if a timestamp should be printed.

### println

    public void println(java.lang.Object message,
                        boolean tagTimestamp)

  Description copied from class: `Log`
  Prints an optionally timestamped message and newline to the log.

  Parameters:
    `message` - the message to print.
    `tagTimestamp` - true if a timestamp should be printed.

### print

    public void print(java.lang.Object message,
                      boolean tagTimestamp,
                      int level)

  Description copied from class: `Log`
  Prints an optionally timestamped message to the log without printing a newline.

  Parameters:
    `message` - the message to print.
    `tagTimestamp` - true if a timestamp should be printed.
    `level` - the logging level for this message.

### println

    public void println(java.lang.Object message,
                        boolean tagTimestamp,
                        int level)

  Description copied from class: `Log`
  Prints an optionally timestamped message and newline to the log.

  Parameters:
    `message` - the message to print.
    `tagTimestamp` - true if a timestamp should be printed.
    `level` - the logging level for this message.

### dispose

    public void dispose()

### isLogged

    public boolean isLogged(int level)

### setLogLevel

    public void setLogLevel(int level)

### log

    public void log(int level,
                    java.lang.String prefix,
                    java.lang.String message,
                    java.lang.Throwable t)

### log

    public void log(int level,
                    java.lang.String message,
                    java.lang.Throwable t)

### log

    public void log(int level,
                    java.lang.String prefix,
                    java.lang.String message)

### processLog

    public void processLog(LogProcesser logProcesser)

  Description copied from class: `Log`
  Perform a "long or complex" operation on the log file

  Parameters:
    `logProcesser` - object that implements the LogProcesser interface

### swapLog

    public void swapLog(java.lang.String logFileName,
                        java.lang.String tempName,
                        java.lang.String backupName)
                 throws java.io.IOException

  Description copied from class: `Log`
  Swap the log file so we can start using a new one

  Parameters:
    `logFileName` - name of the current log file
    `tempName` - file that contains the modified contents (new file)
    `backupName` - name for the current log file after rotation
  Throws:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD