1YAZ-LOG(7)               Conventions and miscellaneous              YAZ-LOG(7)
2
3
4

NAME

6       yaz-log - Log handling in all yaz-based programs
7

SYNOPSIS

9       yaz-XXXX [-v loglevel,...] [-l logfile]
10

DESCRIPTION

12       All YAZ-based programs use a common log subsystem, and should support
13       common command line options for controlling it. This man page documents
14       those.
15

OPTIONS

17       -l logfile
18           Specify the file where the log is to be written. If none is
19           specified, stderr is used. The log is appended to this file. If the
20           file grows overly large, it is silently rotated: It is renamed to
21           logfile.1, logfile.2, .., 9 (old such file is deleted), and a new
22           file is opened. The limit defaults to 1GB, but can be set by the
23           program. The rotating limit can be specified with option -r for the
24           YAZ frontend server (yaz-ztest).
25
26           Rotation can also be implicitly enabled by using a filename which
27           gets changed for a given date, due to substitutions as given by the
28           strftime(3) function.
29
30       -v loglevel
31           Specify the logging level. The argument is a set of log level
32           names, separated by commas (no whitespace!), optionally preceded by
33           a '-' to negate that level. Most programs have their own default,
34           often containing fatal,warn,log, and some application-specific
35           values. The default list can be cleared with the word none, or
36           individual bits can be removed by prefixing them with a dash '-'.
37

LOG LEVELS TO CONTROL LOGGING

39       Some of the log levels control the way the log is written.
40
41       flush causes the log to be flushed after every write. This can have
42       serious implications to performance, and should not be used in
43       production. On the other hand, when debugging a program crash, this can
44       be extremely useful. The option debug implies flush as well.
45
46       notime prevents the writing of time stamps. This is intended for
47       automatic test scripts, which should produce predictable log files that
48       are easy to compare.
49

GENERAL LOG LEVELS IN YAZ ITSELF

51       YAZ itself uses the following log levels:
52
53       fatal for fatal errors, that prevent further execution of the program.
54
55       warn for warnings about things that should be corrected.
56
57       debug for debugging. This flag may be used temporarily when developing
58       or debugging yaz, or a program that uses yaz. It is practically
59       deprecated, you should be defining and using your own log levels (see
60       below).
61
62       all turns on almost all hard-coded log levels.
63
64       loglevel logs information about the log levels used by the program.
65       Every time the log level is changed, lists all bits that are on. Every
66       time a module asks for its log bits, this is logged. This can be used
67       for getting an idea of what log levels are available in any program
68       that uses yaz-log. Start the program with -v none,loglevel, and do some
69       common operations with it. Another way is to grep for
70       yaz_log_module_level in the source code, as in
71
72                 find . -name '*.[ch]' -print |
73                    xargs grep yaz_log_module_level |
74                    grep '"' |
75                    cut -d'"' -f2 |
76                    sort -u
77
78
79       eventl, malloc, nmem, odr are used internally for debugging yaz.
80

LOG LEVELS FOR CLIENTS

82       zoom logs the calls to the zoom API, which may be useful in debugging
83       client applications.
84

LOG LEVELS FOR SERVERS

86       server logs the server functions on a high level, starting up,
87       listening on a port, etc.
88
89       session logs individual sessions (connections).
90
91       request logs a one-liner for each request (init, search, etc.).
92
93       requestdetail logs the details of every request, before it is passed to
94       the back-end, and the results received from it.
95
96       Each server program (zebra, etc.) is supposed to define its own log
97       levels in addition to these. As they depend on the server in question,
98       they can not be described here. See above how to find out about them.
99

LOGGING EXAMPLES

101       See what log levels yaz-ztest is using:
102
103               yaz-ztest -1 -v none,loglevel
104               14:43:29-23/11 [loglevel] Setting log level to 4096 = 0x00001000
105               14:43:29-23/11 [loglevel] Static  log bit 00000001 'fatal' is off
106               14:43:29-23/11 [loglevel] Static  log bit 00000002 'debug' is off
107               14:43:29-23/11 [loglevel] Static  log bit 00000004 'warn' is off
108               14:43:29-23/11 [loglevel] Static  log bit 00000008 'log' is off
109               14:43:29-23/11 [loglevel] Static  log bit 00000080 'malloc' is off
110               14:43:29-23/11 [loglevel] Static  log bit 00000800 'flush' is off
111               14:43:29-23/11 [loglevel] Static  log bit 00001000 'loglevel' is ON
112               14:43:29-23/11 [loglevel] Static  log bit 00002000 'server' is off
113               14:43:29-23/11 [loglevel] Dynamic log bit 00004000 'session' is off
114               14:43:29-23/11 [loglevel] Dynamic log bit 00008000 'request' is off
115               14:44:13-23/11 yaz-ztest [loglevel] returning log bit 0x4000 for 'session'
116               14:44:13-23/11 yaz-ztest [loglevel] returning log bit 0x2000 for 'server'
117               14:44:13-23/11 yaz-ztest [loglevel] returning NO log bit for 'eventl'
118               14:44:20-23/11 yaz-ztest [loglevel] returning log bit 0x4000 for 'session'
119               14:44:20-23/11 yaz-ztest [loglevel] returning log bit 0x8000 for 'request'
120               14:44:20-23/11 yaz-ztest [loglevel] returning NO log bit for 'requestdetail'
121               14:44:20-23/11 yaz-ztest [loglevel] returning NO log bit for 'odr'
122               14:44:20-23/11 yaz-ztest [loglevel] returning NO log bit for 'ztest'
123
124
125       See the details of the requests for yaz-ztest
126
127              ./yaz-ztest -1 -v requestdetail
128              14:45:35-23/11 yaz-ztest [server] Adding static Z3950 listener on tcp:@:9999
129              14:45:35-23/11 yaz-ztest [server] Starting server ./yaz-ztest pid=32200
130              14:45:38-23/11 yaz-ztest [session] Starting session from tcp:127.0.0.1 (pid=32200)
131              14:45:38-23/11 yaz-ztest [requestdetail] Got initRequest
132              14:45:38-23/11 yaz-ztest [requestdetail] Id:        81
133              14:45:38-23/11 yaz-ztest [requestdetail] Name:      YAZ
134              14:45:38-23/11 yaz-ztest [requestdetail] Version:   2.0.28
135              14:45:38-23/11 yaz-ztest [requestdetail] Negotiated to v3: srch prst del extendedServices namedresults scan sort
136              14:45:38-23/11 yaz-ztest [request] Init from 'YAZ' (81) (ver 2.0.28) OK
137              14:45:39-23/11 yaz-ztest [requestdetail] Got SearchRequest.
138              14:45:39-23/11 yaz-ztest [requestdetail] ResultSet '1'
139              14:45:39-23/11 yaz-ztest [requestdetail] Database 'Default'
140              14:45:39-23/11 yaz-ztest [requestdetail] RPN query. Type: Bib-1
141              14:45:39-23/11 yaz-ztest [requestdetail]  term 'foo' (general)
142              14:45:39-23/11 yaz-ztest [requestdetail] resultCount: 7
143              14:45:39-23/11 yaz-ztest [request] Search Z: @attrset Bib-1 foo  OK:7 hits
144              14:45:41-23/11 yaz-ztest [requestdetail] Got PresentRequest.
145              14:45:41-23/11 yaz-ztest [requestdetail] Request to pack 1+1 1
146              14:45:41-23/11 yaz-ztest [requestdetail] pms=1048576, mrs=1048576
147              14:45:41-23/11 yaz-ztest [request] Present: [1] 1+1  OK 1 records returned
148
149
150

LOG FILENAME EXAMPLES

152       A file with format my_YYYYMMDD.log (where Y, M, D is year, month, and
153       day digits) is given as follows: -l my_%Y%m%d.log . And since the
154       filename is depending on day, rotation will occur on midnight.
155
156       A weekly log could be specified as -l my_%Y%U.log.
157

FILES

159       prefix/include/yaz/log.h prefix/src/log.c
160

SEE ALSO

162       yaz(7) yaz-ztest(8) yaz-client(1) strftime(3)
163

AUTHORS

165       Index Data
166
167
168
169YAZ 5.32.0                        05/30/2022                        YAZ-LOG(7)
Impressum