Difference between revisions of "Logging"

From BaseX Documentation
Jump to navigation Jump to search
Line 13: Line 13:
 
In your [[Configuration#Database Directory|Database Directory]], you can find a folder named <code>.logs</code> in which all log files are stored with the according date. Note that, depending on your OS and configuration, files and folders with a '.' prefix may be hidden.
 
In your [[Configuration#Database Directory|Database Directory]], you can find a folder named <code>.logs</code> in which all log files are stored with the according date. Note that, depending on your OS and configuration, files and folders with a '.' prefix may be hidden.
  
Since {{Version|7.4}}, HTTP requests will also be stored in the log files, logging can be turned on/off via the [[Options#LOG|LOG]] option, and the maximum length of logging messages can be changed via [[Options#LOGMAXMSGLEN|LOGMAXMSGLEN]].
+
Since {{Version|7.4}}, HTTP requests will also be stored in the log files, logging can be turned on/off via the [[Options#LOG|LOG]] option, and the maximum length of logging messages can be changed via [[Options#LOGMSGMAXLEN|LOGMSGMAXLEN]].
  
 
==Logformat==
 
==Logformat==

Revision as of 11:33, 9 August 2012

This article is part of the Advanced User's Guide. It describes how client operations are logged by the server.

The server logs give you the following advantages:

  • Overview about all processes executed on your server
  • Tracing of any errors thrown by BaseX
  • Tracing of wrong modified data
  • Tracing of all specific user processes
  • Tracing of time specific processes

The server logs are written in plain-text and can be opened with any editor. In your Database Directory, you can find a folder named .logs in which all log files are stored with the according date. Note that, depending on your OS and configuration, files and folders with a '.' prefix may be hidden.

Since Version 7.4, HTTP requests will also be stored in the log files, logging can be turned on/off via the LOG option, and the maximum length of logging messages can be changed via LOGMSGMAXLEN.

Logformat

Example
16:00:00.094 [127.0.0.1:3920] LOGIN admin OK 
16:00:00.104 [127.0.0.1:3920] XQUERY 1 to 10 OK 12.36 ms
16:00:00.114 [127.0.0.1:3920] LOGOUT admin OK
Now you can see the 'admin' user has the IP 127.0.0.1 with the socketport 3920. With this information you can identify each transaction of the corresponding user.
Example
10:06:36.498 [127.0.0.1:49990] LOGIN admin OK
10:06:53.297 [127.0.0.1:49990] XQUERY 1 to 10 OK	17.89 ms
10:07:03.353 [127.0.0.1:49993] LOGIN testuser OK
10:07:08.259 [127.0.0.1:49993] XQUERY 1 to z Error: Stopped at line 1, column 6:  [XPDY0002] No context item set for 'z'. 9.69 ms
10:07:15.505 [127.0.0.1:49990] LOGOUT admin OK
10:07:19.790 [127.0.0.1:49993] LOGOUT testuser OK
Now you can see the 'admin' user has the IP 127.0.0.1 with the socketport 49990 and the 'testuser' has the IP 127.0.0.1 with the socketport 49993. With this information you can identify each transaction of the corresponding user. The 'testuser' for example executed a query which was aborted by a syntax error.