Sun Java System Web Server 7.0 Update 3 NSAPI Developer's Guide

AddLog() Example

The example in this section demonstrates how to implement brief-log, a custom SAF for logging three items of information about a request: the IP address, the method, and the URI, for example, GET /jocelyn/dogs/homesneeded.html.

Installing the AddLog() Example

To load the shared object containing your functions, add the following directive in the Init section of the magnus.conf file:

Init fn=load-modules 

To call brief-init to open the log file, add the following code to the Init section in magnus.conf. This line must come after the one that loads the library containing brief-init.

Init fn=brief-init 

To execute your custom SAF during the AddLog stage for an object, add the following line to that object in the obj.conf file:

AddLog fn=brief-log

The source code for this example is in addlog.c file in the install-dir/samples/nsapi directory.