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 int` | `day`
`protected java.io.RandomAccessFile` | `errlog`
`static java.lang.String` | `ERRLOGNAME_P` Name of the property indicating the error log file.
`protected int` | `hour`
`protected java.io.RandomAccessFile` | `log`
`static java.lang.String` | `LOGDIRNAME_P` Name of the property indicating the server trace file.
`static java.lang.String` | `LOGNAME_P` Name of the property indicating the log file.
`protected int` | `month`
`protected static java.lang.String[]` | `monthnames`
`protected static java.lang.String` | `noUrl`
`protected ObservableProperties` | `props`
`static java.lang.String` | `ROTATE_LEVEL_P` Name of the property indicating the buffer size for the logger.
`protected int` | `rotateLevel`
`protected httpd` | `server`
`protected java.io.RandomAccessFile` | `trace`
`static java.lang.String` | `TRACELOGNAME_P` Name of the property indicating the server log directory.
`protected int` | `year`

Method Summary
`protected void` | `appendLogBuffer(java.lang.String msg)`
`protected void` | `checkLogFile(java.util.Date now)`
`protected void` | `dateCache(long date, java.lang.StringBuffer sb)` It actually does multiple things, check when to rotate log files and also dumps the formatted date string to a stringbuffer it is dirty but hopefully faster than the previous version of the logger
`void` | `errlog(Client client, java.lang.String msg)` Log an error on behalf of some client object in the error log.
`void` | `errlog(java.lang.String msg)` Log an error on behalf of the server object.
`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)` Log a message to the log.
`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` | `openLogFile(int year)`
`protected void` | `openLogFile(int year, int month)`
`protected void` | `openLogFile(int year, int month, int day)`
`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)` Log a client trace.
`void` | `trace(java.lang.String msg)` Log a server trace.
`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

### monthnames

    protected static final java.lang.String[] monthnames

### noUrl

    protected static java.lang.String noUrl

### 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.

### LOGDIRNAME_P

    public static final java.lang.String LOGDIRNAME_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.

### TRACELOGNAME_P

    public static final java.lang.String TRACELOGNAME_P

  Name of the property indicating the server log directory.

  This property defaults to the `logs` directory in the server main 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.

### ROTATE_LEVEL_P

    public static final java.lang.String ROTATE_LEVEL_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

### bufsize

    protected int bufsize

### bufptr

    protected int bufptr

### rotateLevel

    protected int rotateLevel

### buffer

    protected byte[] buffer

### year

    protected int year

### month

    protected int month

### day

    protected int day

### hour

    protected int hour

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)

### checkLogFile

    protected void checkLogFile(java.util.Date now)

### openLogFile

    protected void openLogFile(int year,
                               int month,
                               int day)

### openLogFile

    protected void openLogFile(int year,
                               int month)

### openLogFile

    protected void openLogFile(int year)

### dateCache

    protected void dateCache(long date,
                             java.lang.StringBuffer sb)

  It actually does multiple things, check when to rotate log files and also dumps the formatted date string to a stringbuffer it is dirty but hopefully faster than the previous version of the logger

### 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
  Tags copied from class: Logger
  Parameters:
    `client` - The client which made the request.
    `request` - The request that was handled.
    `reply` - The emitted reply to the client.
    `nbytes` - The number of bytes sent to this client.
    `duration` - The time it took to process the request.

### log

    public void log(java.lang.String msg)

  Description copied from class: Logger
  Log a message to the log.
  Overrides:
    log in class Logger
  Tags copied from class: Logger
  Parameters:
    `msg` - The message to log.

### errlog

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

  Description copied from class: Logger
  Log an error on behalf of some client object in the error log.
  Overrides:
    errlog in class Logger
  Tags copied from class: Logger
  Parameters:
    `client` - The client for which the error occured.
    `msg` - The error message to log.

### errlog

    public void errlog(java.lang.String msg)

  Description copied from class: Logger
  Log an error on behalf of the server object.
  Overrides:
    errlog in class Logger
  Tags copied from class: Logger
  Parameters:
    `msg` - The message to emit.

### trace

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

  Description copied from class: Logger
  Log a client trace. The client may be in some error state, so all access to the client parameter should be checked.
  Overrides:
    trace in class Logger
  Tags copied from class: Logger
  Parameters:
    `client` - The client that wants to emit a trace.
    `trace` - The trace to log.

### trace

    public void trace(java.lang.String msg)

  Description copied from class: Logger
  Log a server trace.
  Overrides:
    trace in class Logger
  Tags copied from class: Logger
  Parameters:
    `msg` - The trace to emit.

### 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.
  Overrides:
    initialize in class Logger
  Parameters:
    `server` - The server to which thiss logger should initialize.

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