All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.server.log.Log

java.lang.Object
   |
   +----com.sun.server.log.Log

public class Log
extends Object
This is the base class for all server logging streams. Note that no particular type of underlying OutputStream is required. The various protected print methods are intended as convenience methods for implementors of logging streams.

Classes extending this class should provide stream-specfic methods, conventionally using write in their method names, which format the logging data and write it to the OutputStream.

There is the notion of a pair of process-wide default logging streams. One is used for event logging; the other is used to record errors. Both of these streams default to null logs, so that subsystems may always write to the streams without external effect. Servers may replace the null logs with non-null logs, so that data logged by those subsystems can be processed.

Processes which use the default logging streams must guard against garbage collection of the class by keeping a "live" instance. Otherwise the internal static data will be reinitialized at unpredictable times.


Variable Index

 o lineSeparator
System line separator

Constructor Index

 o Log()
Create a new Log.
 o Log(OutputStream)
Create a new Log writing to OutputStream specified.

Method Index

 o close()
Closes the output stream.
 o flush()
Flushes pending output.
 o getErrorLog()
Returns the process-wide default error log.
 o getEventLog()
Returns the process-wide default trace log.
 o getLevel()
Returns the current logging level.
 o getOptions()
Get an array of the options set for this log
 o getOutputStream()
Return the output stream used for writing the log.
 o print(int)
Prints an integer value.
 o print(long)
Prints a long value.
 o print(String)
Prints an ASCII string.
 o println()
Prints a line separator.
 o println(int)
Prints an integer value followed by a line separator.
 o println(long)
Prints a long value followed by a line separator.
 o println(String)
Prints an ASCII string followed by a line separator.
 o setErrorLog(TraceLog)
Sets the process-wide default error log.
 o setEventLog(TraceLog)
Sets the process-wide default trace log.
 o setLevel(int)
Sets the logging level.
 o setOptions(String)
Sets logging options.
 o setOutputStream(OutputStream)
Sets logging output to the specified output stream.
 o useGMT()
return whether or not GMT time usage is in effect.
 o useGMT(boolean)
If true specified then use GMT for date output, else use local time.

Variables

 o lineSeparator
 protected static final String lineSeparator
System line separator

Constructors

 o Log
 public Log()
Create a new Log.

 o Log
 public Log(OutputStream out)
Create a new Log writing to OutputStream specified.

Parameters:
out - The OutputStream to write log information to.

Methods

 o setErrorLog
 public static synchronized boolean setErrorLog(TraceLog log)
Sets the process-wide default error log. This may only be assigned a single time.

Parameters:
log - the desired process-wide default error log
Returns:
true iff the error log was assigned
 o getErrorLog
 public static TraceLog getErrorLog()
Returns the process-wide default error log.

 o setEventLog
 public static synchronized boolean setEventLog(TraceLog log)
Sets the process-wide default trace log. This may only be assigned a single time.

Parameters:
log - the desired process-wide default trace log
Returns:
true iff the trace log was assigned
 o getEventLog
 public static TraceLog getEventLog()
Returns the process-wide default trace log.

 o useGMT
 public synchronized void useGMT(boolean useGMT)
If true specified then use GMT for date output, else use local time.

Parameters:
useGMT - GMT flag
 o useGMT
 public boolean useGMT()
return whether or not GMT time usage is in effect.

 o setOutputStream
 public synchronized void setOutputStream(OutputStream out)
Sets logging output to the specified output stream.

Parameters:
out - the output stream
 o getOutputStream
 public OutputStream getOutputStream()
Return the output stream used for writing the log.

 o setLevel
 public synchronized void setLevel(int level)
Sets the logging level. A level of 0 disables logging, and higher levels produce more detailed output.

Parameters:
level - the new logging level
 o getLevel
 public synchronized int getLevel()
Returns the current logging level.

 o setOptions
 public synchronized void setOptions(String optionstr)
Sets logging options. Logging options are class specific options that effect the format of the log written, or additional actions at the time of the logging activity. This method should be overridden if any specific initialization needs to be done at the time an option is set.

Parameters:
options - A space delimited list of options
 o getOptions
 public synchronized String[] getOptions()
Get an array of the options set for this log

 o flush
 public synchronized void flush()
Flushes pending output.

 o close
 public synchronized void close()
Closes the output stream.

 o print
 public synchronized void print(String s) throws IOException
Prints an ASCII string.

Parameters:
s - the string to be printed
Throws: IOException
if an i/o error has occurred
 o print
 public synchronized void print(int i) throws IOException
Prints an integer value.

Parameters:
i - the integer to be printed
Throws: IOException
if an i/o error has occurred
 o print
 public synchronized void print(long l) throws IOException
Prints a long value.

Parameters:
l - the long to be printed
Throws: IOException
if an i/o error has occurred
 o println
 public synchronized void println(String s) throws IOException
Prints an ASCII string followed by a line separator.

Parameters:
s - the string to be printed
Throws: IOException
if an i/o error has occurred
 o println
 public synchronized void println(int i) throws IOException
Prints an integer value followed by a line separator.

Parameters:
i - the integer to be printed
Throws: IOException
if an i/o error has occurred
 o println
 public synchronized void println(long l) throws IOException
Prints a long value followed by a line separator.

Parameters:
l - the long to be printed
Throws: IOException
if an i/o error has occurred
 o println
 public synchronized void println() throws IOException
Prints a line separator.


All Packages  Class Hierarchy  This Package  Previous  Next  Index