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

## org.w3c.jigsaw.http
Class CommonLogger

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

Direct Known Subclasses:
  ExtendedCommonLogger

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`

Field Summary
`protected byte[]` | `buffer`
`protected int` | `bufptr`
`protected int` | `bufsize`
`static java.lang.String` | `BUFSIZE_P` Name of the property indicating the buffer size for the logger.
`protected java.io.RandomAccessFile` | `errlog`
`static java.lang.String` | `ERRLOGNAME_P` Name of the property indicating the error log file.
`protected java.io.RandomAccessFile` | `log`
`protected java.lang.String` | `logdir`
`static java.lang.String` | `LOGNAME_P` Name of the property indicating the log file.
`protected ObservableProperties` | `props`
`protected httpd` | `server`
`protected java.io.RandomAccessFile` | `trace`
`static java.lang.String` | `TRACELOGNAME_P` Name of the property indicating the server trace file.

Method Summary
`protected void` | `appendLogBuffer(java.lang.String msg)`
`void` | `errlog(Client client, java.lang.String msg)`
`void` | `errlog(java.lang.String msg)`
`protected void` | `errlogmsg(java.lang.String msg)`
`protected java.lang.String` | `getFilename(java.lang.String propname, java.lang.String def)` Get the name for the file indicated by the provided property.
`void` | `initialize(httpd server)` Initialize this logger for the given server.
`void` | `log(Request request, Reply reply, int nbytes, long duration)` Log the given HTTP transaction.
`void` | `log(java.lang.String msg)`
`protected void` | `logmsg(java.lang.String msg)`
`protected void` | `openErrorLogFile()` Open this logger error log file.
`protected void` | `openLogFile()` Open this logger log file.
`protected void` | `openTraceFile()` Open this logger trace file.
`protected void` | `output(java.io.RandomAccessFile f, java.lang.String msg)` Output the given message to the given RandomAccessFile.
`boolean` | `propertyChanged(java.lang.String name)` Property monitoring for the logger.
`void` | `shutdown()` Shutdown this logger.
`void` | `sync()` Save all pending data to stable storage.
`void` | `trace(Client client, java.lang.String msg)`
`void` | `trace(java.lang.String msg)`
`protected void` | `tracemsg(java.lang.String msg)`

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

Field Detail

### LOGNAME_P

    public static final java.lang.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 static final java.lang.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 static final java.lang.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 static final java.lang.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 java.io.RandomAccessFile log

### errlog

    protected java.io.RandomAccessFile errlog

### trace

    protected java.io.RandomAccessFile trace

### server

    protected httpd server

### props

    protected ObservableProperties props

### logdir

    protected java.lang.String logdir

### bufsize

    protected int bufsize

### bufptr

    protected int bufptr

### buffer

    protected byte[] buffer

Method Detail

### propertyChanged

    public boolean propertyChanged(java.lang.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.
  Specified by:
    propertyChanged in interface PropertyMonitoring
  Parameters:
    `name` - The name of the property that has changed.
  Returns:
    A boolean, true if the change was made, false otherwise.

### output

    protected void output(java.io.RandomAccessFile f,
                          java.lang.String msg)
                   throws java.io.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:
    java.io.IOException - If writing to the output failed.

### appendLogBuffer

    protected void appendLogBuffer(java.lang.String msg)
                            throws java.io.IOException

### logmsg

    protected void logmsg(java.lang.String msg)

### errlogmsg

    protected void errlogmsg(java.lang.String msg)

### tracemsg

    protected void tracemsg(java.lang.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(java.lang.String msg)

  Overrides:
    log in class Logger

### errlog

    public void errlog(Client client,
                       java.lang.String msg)

  Overrides:
    errlog in class Logger

### errlog

    public void errlog(java.lang.String msg)

  Overrides:
    errlog in class Logger

### trace

    public void trace(Client client,
                      java.lang.String msg)

  Overrides:
    trace in class Logger

### trace

    public void trace(java.lang.String msg)

  Overrides:
    trace in class Logger

### getFilename

    protected java.lang.String getFilename(java.lang.String propname,
                                           java.lang.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 void sync()

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

### shutdown

    public 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

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