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.
-
lineSeparator
- System line separator
-
Log()
- Create a new Log.
-
Log(OutputStream)
-
Create a new Log writing to OutputStream specified.
-
close()
- Closes the output stream.
-
flush()
-
Flushes pending output.
-
getErrorLog()
- Returns the process-wide default error log.
-
getEventLog()
- Returns the process-wide default trace log.
-
getLevel()
- Returns the current logging level.
-
getOptions()
- Get an array of the options set for this log
-
getOutputStream()
- Return the output stream used for writing the log.
-
print(int)
- Prints an integer value.
-
print(long)
- Prints a long value.
-
print(String)
- Prints an ASCII string.
-
println()
- Prints a line separator.
-
println(int)
- Prints an integer value followed by a line separator.
-
println(long)
- Prints a long value followed by a line separator.
-
println(String)
- Prints an ASCII string followed by a line separator.
-
setErrorLog(TraceLog)
- Sets the process-wide default error log.
-
setEventLog(TraceLog)
- Sets the process-wide default trace log.
-
setLevel(int)
- Sets the logging level.
-
setOptions(String)
- Sets logging options.
-
setOutputStream(OutputStream)
- Sets logging output to the specified output stream.
-
useGMT()
- return whether or not GMT time usage is in effect.
-
useGMT(boolean)
- If true specified then use GMT for date output, else use local time.
lineSeparator
protected static final String lineSeparator
- System line separator
Log
public Log()
- Create a new Log.
Log
public Log(OutputStream out)
- Create a new Log writing to OutputStream specified.
- Parameters:
- out - The OutputStream to write log information to.
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
getErrorLog
public static TraceLog getErrorLog()
- Returns the process-wide default error log.
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
getEventLog
public static TraceLog getEventLog()
- Returns the process-wide default trace log.
useGMT
public synchronized void useGMT(boolean useGMT)
- If true specified then use GMT for date output, else use local time.
- Parameters:
- useGMT - GMT flag
useGMT
public boolean useGMT()
- return whether or not GMT time usage is in effect.
setOutputStream
public synchronized void setOutputStream(OutputStream out)
- Sets logging output to the specified output stream.
- Parameters:
- out - the output stream
getOutputStream
public OutputStream getOutputStream()
- Return the output stream used for writing the log.
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
getLevel
public synchronized int getLevel()
- Returns the current logging level.
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
getOptions
public synchronized String[] getOptions()
- Get an array of the options set for this log
flush
public synchronized void flush()
- Flushes pending output.
close
public synchronized void close()
- Closes the output stream.
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
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
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
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
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
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
println
public synchronized void println() throws IOException
- Prints a line separator.
All Packages Class Hierarchy This Package Previous Next Index