AddLog() Example

                                                                                                                                                                                                                                                                                                                                      Back to [Book]     [Topic]

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
  • The URI, for example, 198.93.95.99 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 
     shlib=_your-library_ 
     funcs=brief-init,brief-log

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 
     file=/tmp/brief.log

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.

Labels

java java Delete
server server Delete
sun sun Delete
webserver webserver Delete
application application Delete
system system Delete
webtier webtier Delete
guide guide Delete
webserver70 webserver70 Delete
sunjava sunjava Delete
developers developers Delete
web web Delete
developersguide developersguide Delete
nsapiguide nsapiguide Delete
+nsapiguide +nsapiguide Delete
nsapidevelopersguide nsapidevelopersguide Delete
nsapi nsapi Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact