    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

##

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

##

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

##

LOGNAME_P

      public final static 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.

ERRLOGNAME_P

      public final static 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.

TRACELOGNAME_P

      public final static 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.

BUFSIZE_P

      public final static 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.

log

      protected RandomAccessFile log

errlog

      protected RandomAccessFile errlog

trace

      protected RandomAccessFile trace

server

      protected httpd server

props

      protected ObservableProperties props

logdir

      protected String logdir

bufsize

      protected int bufsize

bufptr

      protected int bufptr

buffer

      protected byte buffer[]

##

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.

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.

appendLogBuffer

      protected synchronized void appendLogBuffer(String msg) throws IOException

logmsg

      protected void logmsg(String msg)

errlogmsg

      protected void errlogmsg(String msg)

tracemsg

      protected void tracemsg(String msg)

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

log

      public void log(String msg)

  Log a message to the log.
  Overrides:
    log in class Logger

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

errlog

      public void errlog(String msg)

  Log an error on behalf of the server object.
  Overrides:
    errlog in class Logger

trace

      public void trace(Client client,
                        String msg)

  Log a client trace.
  Overrides:
    trace in class Logger

trace

      public void trace(String msg)

  Log a server trace.
  Overrides:
    trace in class Logger

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.

openLogFile

      protected void openLogFile()

  Open this logger log file.

openErrorLogFile

      protected void openErrorLogFile()

  Open this logger error log file.

openTraceFile

      protected void openTraceFile()

  Open this logger trace file.

sync

      public synchronized void sync()

  Save all pending data to stable storage.
  Overrides:
    sync in class Logger

shutdown

      public synchronized void shutdown()

  Shutdown this logger.
  Overrides:
    shutdown in class Logger

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