Changes

Jump to navigation Jump to search
56 bytes removed ,  13:47, 19 August 2021
This article is part of the [[Advanced User's Guide]]. It describes how client operations are logged by the server.The server logs can e.g. be used to get an overview of all processes executed on your server, trace any errorsor compile performance statistics.
==Introduction==
The server logs are written in plain text. 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 beinning beginning with a <code>.</code> may be hidden. The log directory can be changed via the {{Option|LOGPATH}} option.
{{Mark|Updated with Version 9.3:}} If BaseX is running as used in a [[Web Application]], all trace output (generated via {{Code|fn:trace}}, {{Function|Profiling|prof:dump}} and similar functions) will be stored in the logs as well.
Some more notes on the logging facility:
* The maximum length of logging messages can be changed via {{Option|LOGMSGMAXLEN}}.
* The [[Admin Module]] provides access to the log files from XQuery.
 
If a proxy is used, the original IP address of the client will be added to the logs.
==RESTXQ==
 
{{Mark|Updated with Version 9.3:}} The request attributes will be checked for a user id.
By default, RESTXQ code is executed with the {{Code|admin}} user. As a result, this user will be displayed in the logs for all RESTXQ requests. In a web application with a custom user management, however, the name of the actual user who has sent a request is often more relevant.
; Example 1:
<syntaxhighlightpre>
01:18:12.892 SERVER admin OK Server was started (port: 1984)
01:18:15.436 127.0.0.1:4722 jack REQUEST XQUERY for $i in 1 to 5 return random:double()
01:18:15.447 127.0.0.1:4722 jack REQUEST EXIT
01:18:15.447 127.0.0.1:4722 jack OK 0.39 ms
</syntaxhighlightpre>
A server has been started and a user <code>jack</code> has connected to the server to perform a query and exit properly.
; Example 2:
<syntaxhighlightpre>
01:23:33.251 127.0.0.1:4736 john OK QUERY[0] 'hi' 0.44 ms
01:23:33.337 127.0.0.1:4736 john OK ITER[0] 1.14 ms
01:23:33.359 127.0.0.1:4736 john REQUEST EXIT
01:23:33.359 127.0.0.1:4736 john OK 0.14 ms
</syntaxhighlightpre>
A user <code>john</code> has performed an iterative query, using one of the client APIs.
; Example 3:
<syntaxhighlightpre>
01:31:51.888 127.0.0.1:4803 admin REQUEST [GET] http://localhost:8984/rest/factbook
01:31:51.892 127.0.0.1:4803 admin 200 4.43 ms
</syntaxhighlightpre>
An admin user has accessed the <code>factbook</code> database via REST.
=Changelog=
 
;Version 9.5
* Updated: Show IP address behind proxy.
;Version 9.3
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu