NaviServer Log Files

https://web.archive.org/web/20161211211830/naviserver.sourceforge.net/ns_logobig.gif

MainSource Code Downloads API Documentation Mailing Lists Bugs Developers


Logfiles

Error Log

One of your best companions will sooner or later become the ns_log command. When NaviServer is running in the background certain events from notices to fatal errors are logged to the Server logfile along with the time of the event. Use ns_log for all kinds of debugging purposes or for tracking information from non-connection threads, e.g. scheduled procedures.

ns_log takes two arguments: A severity argument and the message. Severity may be one of

  • Notice
  • Warning
  • Error
  • Fatal
  • Bug
  • Debug (controlled by logdebug parameter in config file)
  • Dev (controlled by logdev parameter in config file)

Examples of log statements (from NaviServer and from within command mode)

 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: encoding: loaded: iso8859-1
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: nsmain: NaviServer/4.99.0 starting
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: nsmain: security info: uid=503, euid=503, gid=8, egid=8
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: nsmain: max files: FD_SETSIZE = 1024, rl_cur = 1024, rl_max = 1024
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: adp[server1]: mapped /*.adp
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: adp[server1]: mapped /*.u_adp
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: adp[server1]: mapped /*.gb_adp
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: adp[server1]: mapped /*.sjis_adp
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: modload: loading '/usr/local/ns/bin/nssock.so'
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: modload: loading '/usr/local/ns/bin/nslog.so'
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: nslog: opened '/usr/local/ns/servers/server1/modules/nslog/access.log'
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: conf: [ns/server/server1]enabletclpages = 0
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: nsmain: NaviServer/4.99.0 running
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: nsmain: security info: uid=503, euid=503, gid=8, egid=8
 [30/Mar/2008:10:33:54][7540.1082407856][-sched-] Notice: sched: starting
 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Notice: nssock: listening on 10.1.0.110:8000
 [30/Mar/2008:10:33:54][7540.1084509104][-driver-] Notice: starting
 [30/Mar/2008:10:33:54][7540.1084509104][-driver-] Notice: driver: accepting connections

% ns_log Warning "server has to log a useless statement"

 [30/Mar/2008:10:33:54][7540.1076887680][-main-] Warning: server has to log a useless statement

For configuration details take a look at Server Logfile configuration.

Access Log

All HTTP requests to NaviServer are appended to the Access log. It stores lines like

 10.0.1.111 - - [17/Jun/2005:09:00:45 +0200] "GET /intranet/mat/space.gif HTTP/1.1" 304 0 "" "Opera/8.0 (X11; Linux i686; U; en)" 0.125860
 10.0.1.111 - - [17/Jun/2005:09:00:45 +0200] "GET /favicon.ico HTTP/1.1" 404 310 "" "Opera/8.0 (X11; Linux i686; U; en)" 0.004570

The command ns_accesslog allows to fetch the name of the current access logfile or to roll it. There are plenty of parameters available to configure what, when and how to log and roll.

For configuration details take a look at Access Log configuration.