All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.jigsaw.http.CommonLogger

java.lang.Object
   |
   +----w3c.jigsaw.http.Logger
           |
           +----w3c.jigsaw.http.CommonLogger

public class CommonLogger
extends Logger
implements PropertyMonitoring
The CommonLogger class implements the abstract Logger class. The resulting log will conform to the common log format).

See Also:
Logger

Variable Index

 o buffer
 o bufptr
 o bufsize
 o BUFSIZE_P
Name of the property indicating the buffer size for the logger.
 o errlog
 o ERRLOGNAME_P
Name of the property indicating the error log file.
 o log
 o logdir
 o LOGNAME_P
Name of the property indicating the log file.
 o props
 o server
 o trace
 o TRACELOGNAME_P
Name of the property indicating the server trace file.

Method Index

 o appendLogBuffer(String)
 o errlog(Client, String)
Log an error on behalf of some client object in the error log.
 o errlog(String)
Log an error on behalf of the server object.
 o errlogmsg(String)
 o getFilename(String, String)
Get the name for the file indicated by the provided property.
 o initialize(httpd)
Initialize this logger for the given server.
 o log(Request, Reply, int, long)
Log the given HTTP transaction.
 o log(String)
Log a message to the log.
 o logmsg(String)
 o openErrorLogFile()
Open this logger error log file.
 o openLogFile()
Open this logger log file.
 o openTraceFile()
Open this logger trace file.
 o output(RandomAccessFile, String)
Output the given message to the given RandomAccessFile.
 o propertyChanged(String)
Property monitoring for the logger.
 o shutdown()
Shutdown this logger.
 o sync()
Save all pending data to stable storage.
 o trace(Client, String)
Log a client trace.
 o trace(String)
Log a server trace.
 o tracemsg(String)

Variables

 o LOGNAME_P
 public static final String LOGNAME_P
Name of the property indicating the log file. This property indicates the name of the log file to use.

This property defaults to the log file in the server log directory.

 o ERRLOGNAME_P
 public static final String ERRLOGNAME_P
Name of the property indicating the error log file. This property indicates the name of the error log file to use.

This property defaults to the errlog file in the server log directory.

 o TRACELOGNAME_P
 public static final String TRACELOGNAME_P
Name of the property indicating the server trace file. This property indicates the name of the trace file to use.

This property defaults to the trace file in the server log directory.

 o BUFSIZE_P
 public static final String BUFSIZE_P
Name of the property indicating the buffer size for the logger. This buffer size applies only the the log file, not to the error log file, or the trace log file. It can be set to zero if you want no buffering.

This property default to 4096.

 o log
 protected RandomAccessFile log
 o errlog
 protected RandomAccessFile errlog
 o trace
 protected RandomAccessFile trace
 o server
 protected httpd server
 o props
 protected ObservableProperties props
 o logdir
 protected String logdir
 o bufsize
 protected int bufsize
 o bufptr
 protected int bufptr
 o buffer
 protected byte buffer[]

Methods

 o propertyChanged
 public boolean propertyChanged(String name)
Property monitoring for the logger. The logger allows you to dynamically (typically through the property setter) change the names of the file to which it logs error, access and traces.

Parameters:
name - The name of the property that has changed.
Returns:
A boolean, true if the change was made, false otherwise.
 o output
 protected synchronized void output(RandomAccessFile f,
                                    String msg) throws IOException
Output the given message to the given RandomAccessFile. This method makes its best effort to avoid one byte writes (which you get when writing the string as a whole). It first copies the string bytes into a private byte array, and than, write them all at once.

Parameters:
f - The RandomAccessFile to write to, which should be one of log, errlog or trace.
msg - The message to be written.
Throws: IOException
If writing to the output failed.
 o appendLogBuffer
 protected synchronized void appendLogBuffer(String msg) throws IOException
 o logmsg
 protected void logmsg(String msg)
 o errlogmsg
 protected void errlogmsg(String msg)
 o tracemsg
 protected void tracemsg(String msg)
 o log
 public void log(Request request,
                 Reply reply,
                 int nbytes,
                 long duration)
Log the given HTTP transaction. This is shamelessly slow.

Overrides:
log in class Logger
 o log
 public void log(String msg)
Log a message to the log.

Overrides:
log in class Logger
 o errlog
 public void errlog(Client client,
                    String msg)
Log an error on behalf of some client object in the error log.

Overrides:
errlog in class Logger
 o errlog
 public void errlog(String msg)
Log an error on behalf of the server object.

Overrides:
errlog in class Logger
 o trace
 public void trace(Client client,
                   String msg)
Log a client trace.

Overrides:
trace in class Logger
 o trace
 public void trace(String msg)
Log a server trace.

Overrides:
trace in class Logger
 o getFilename
 protected String getFilename(String propname,
                              String def)
Get the name for the file indicated by the provided property. This method first looks for a property value. If none is found, it than constructs a default filename from the server root, by using the provided default name.

This method shall either succeed in getting a filename, or throw a runtime exception.

Parameters:
propname - The name of the property.
def - The default file name to use.
Throws: HTTPRuntimeException
If no file name could be deduced from the provided set of properties.
 o openLogFile
 protected void openLogFile()
Open this logger log file.

 o openErrorLogFile
 protected void openErrorLogFile()
Open this logger error log file.

 o openTraceFile
 protected void openTraceFile()
Open this logger trace file.

 o sync
 public synchronized void sync()
Save all pending data to stable storage.

Overrides:
sync in class Logger
 o shutdown
 public synchronized void shutdown()
Shutdown this logger.

Overrides:
shutdown in class Logger
 o initialize
 public void initialize(httpd server)
Initialize this logger for the given server. This method gets the server properties describe above to initialize its various log files.

Parameters:
server - The server to which thiss logger should initialize.
Overrides:
initialize in class Logger

All Packages  Class Hierarchy  This Package  Previous  Next  Index