|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.jigsaw.http.Logger org.w3c.jigsaw.http.CommonLogger
public class CommonLogger
The CommonLogger class implements the abstract Logger class. The resulting log will conform to the common log format).
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 |
---|
protected static final java.lang.String[] monthnames
protected static java.lang.String noUrl
public static final java.lang.String LOGNAME_P
This property defaults to the log
file in the server
log directory.
public static final java.lang.String ERRLOGNAME_P
This property defaults to the errlog
file in the
server log directory.
public static final java.lang.String LOGDIRNAME_P
This property defaults to the trace
file in the
server log directory.
public static final java.lang.String TRACELOGNAME_P
This property defaults to the logs
directory in the
server main directory.
public static final java.lang.String BUFSIZE_P
This property default to 4096.
public static final java.lang.String ROTATE_LEVEL_P
This property default to 4096.
protected java.io.RandomAccessFile log
protected java.io.RandomAccessFile errlog
protected java.io.RandomAccessFile trace
protected httpd server
protected ObservableProperties props
protected int bufsize
protected int bufptr
protected int rotateLevel
protected byte[] buffer
protected int year
protected int month
protected int day
protected int hour
Method Detail |
---|
public boolean propertyChanged(java.lang.String name)
propertyChanged
in interface PropertyMonitoring
name
- The name of the property that has changed.
protected void output(java.io.RandomAccessFile f, java.lang.String msg) throws java.io.IOException
f
- The RandomAccessFile to write to, which should be one of
log, errlog or trace.msg
- The message to be written.
java.io.IOException
- If writing to the output failed.protected void appendLogBuffer(java.lang.String msg) throws java.io.IOException
java.io.IOException
protected void logmsg(java.lang.String msg)
protected void errlogmsg(java.lang.String msg)
protected void tracemsg(java.lang.String msg)
protected void checkLogFile(java.util.Date now)
protected void openLogFile(int year, int month, int day)
protected void openLogFile(int year, int month)
protected void openLogFile(int year)
protected void dateCache(long date, java.lang.StringBuffer sb)
public void log(Request request, Reply reply, int nbytes, long duration)
log
in class Logger
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.public void log(java.lang.String msg)
Logger
log
in class Logger
msg
- The message to log.public void errlog(Client client, java.lang.String msg)
Logger
errlog
in class Logger
client
- The client for which the error occured.msg
- The error message to log.public void errlog(java.lang.String msg)
Logger
errlog
in class Logger
msg
- The message to emit.public void trace(Client client, java.lang.String msg)
Logger
trace
in class Logger
client
- The client that wants to emit a trace.msg
- The trace to log.public void trace(java.lang.String msg)
Logger
trace
in class Logger
msg
- The trace to emit.protected java.lang.String getFilename(java.lang.String propname, java.lang.String def)
This method shall either succeed in getting a filename, or throw a runtime exception.
propname
- The name of the property.def
- The default file name to use.
HTTPRuntimeException
- If no file name could be deduced from
the provided set of properties.protected void openLogFile()
protected void openErrorLogFile()
protected void openTraceFile()
public void sync()
sync
in class Logger
public void shutdown()
shutdown
in class Logger
public void initialize(httpd server)
initialize
in class Logger
server
- The server to which thiss logger should initialize.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |