You use the LogEntry
class to create a log entry consisting of one or more key/value pairs.
Most report items that the Report Generator can output require a LogEntry
object with at least one key/value pair (although, some report elements do not require any key/value pairs). In general, each LogEntry
corresponds to a single request (such as the number of search-only requests or the number of search requests returning no results).
For example, to output the Request and Session Summary report item, you must ensure that your log entries have a session ID key/value pair. The following code shows how to retrieve the session ID from the browser request object, and then use it to populate a LogEntry
object. (It does not include the code for generating the sid.)
//Retrieve the session ID from the query string. String sid = request.getParameter(“sid”); //Create a log entry and populate it with the session ID. LogEntry entry = new LogEntry(); entry.putString(“SESSION_ID”, sid);
A LogEntry
can contain many key/value pairs, and they may or may not be related. For example, in the reference implementation’s logging_functions
module, the key/value pairs required to generate all of the Guided Search report elements are contained in a single LogEntry
object.
This is good practice, for it allows the application to log a single LogEntry
for each browser request, and then use that entry to create a complete set of report elements. You can use the logging_functions module as a reference for which key/value pairs are required for each Guided Search report element.
Note
The reference implementation is located in $ENDECA_REFERENCE_DIR
on Windows, or %ENDECA_REFERENCE_DIR%
on UNIX. This is C:\Endeca\PlatformServices\reference
on Windows, or endeca/PlatformServices/reference
on UNIX.
//Retrieve the session ID from the query string. String sid = request.getParameter(“sid”); //Create a log entry and populate it with the session ID. LogEntry entry = new LogEntry(); entry.putString(“SESSION_ID”, sid);
String sid = Request.QueryString[“sid”]; //Create a log entry and populate it with the session ID. LogEntry entry = new LogEntry(); entry.AddString(“SESSION_ID”, sid);