public class ClfLogger
extends java.lang.Object
The combined log format has the same first seven fields as the common log format, and adds two more fields: referrer and user-agent.
The DLESE extension to the combined log format adds several more fields, documented below.
The fields, with their normal CGI variable names, are:
-
-
samuel
[10/Nov/2002:07:48:54 -0700]
"GET /testldap/tldap HTTP/1.1"
200
7638
"-"
"http://quake.dpc.ucar.edu/index.html"
"-"
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529"
localhost
80
search
98
9000
1
"-"
"<criteria testattr=\"testval\"><field>Free Text</field><textSearchValue>oceanography</textSearchValue><textSearchTerm>oceanography</textSearchTerm><field>Grade Level</field><LearningContext>High school</LearningContext></criteria>"
public class TestServlet extends HttpServlet { ClfLogger logger = null; public void init( ServletConfig conf) throws ServletException { super.init(conf); String logfile = getInitParameter("test.log.file.name"); try { logger = DleseLogManager.getClfLogger( Level.FINEST, // minimum level this logger will accept true, // append logfile); // output log file } catch( LogException dle) { log("cannot init ClfLogger: " + dle); logger = null; } } // end init public void doGet( HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { int statusCode = 200; int contentLen = 0; int numSearchResults = 98; int numDbRecs = 9000; int rankNum = 1; String xmlString = "<someTag someAttr="xyz">some contents</someTag>"; logger.log( java.util.logging.Level.SEVERE, // message importance req, // the incoming request statusCode, // returned http status code contentLen, // returned content len, bytes "search", // type: search, full, or other numSearchResults, // num search results numDbRecs, // total num records in the database rankNum, // if search: rank of first rec in page // if full: rank of this rec null, // dleseId: if full: dlese ID of this rec xmlString); // xml stg. Will appear in double quotes. // Internal backslashes, quotes, double quotes, // newlines, etc. will be escaped. } // end doGet } // end class TestServlet
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
log(java.util.logging.Level level,
javax.servlet.http.HttpServletRequest req,
int statusCode,
int contentLen,
java.lang.String requestType,
int numSearchResults,
int numDbRecords,
int rankNum,
java.lang.String dleseId,
java.lang.String xmlString) |
public void close() throws LogException
LogException
public void log(java.util.logging.Level level, javax.servlet.http.HttpServletRequest req, int statusCode, int contentLen, java.lang.String requestType, int numSearchResults, int numDbRecords, int rankNum, java.lang.String dleseId, java.lang.String xmlString)