1YAZ-LOG(7)                                                          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 names,
32          separated by commas (no whitespace!), optionally preceded by a '-'
33          to negate that level. Most programs have their own default, often
34          containing fatal,warn,log, and some application-specific values. The
35          default list can be cleared with the word none, or individual bits
36          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
80       eventl, malloc, nmem, odr are used internally for debugging yaz.
81

LOG LEVELS FOR CLIENTS

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

LOG LEVELS FOR SERVERS

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

LOGGING EXAMPLES

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

LOG FILENAME EXAMPLES

154       A file with format my_YYYYMMDD.log is where Y, M, D is year, month, and
155       day digits is given as follows -l my_%Y%m%d.log
156
157       A weekly log could be specified as -l my_%Y%U.log.
158

FILES

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

SEE ALSO

163       yaz(7) yaz-ztest(8) yaz-client(1) strftime(3)
164
165
166
167YAZ 2.1.54                        03/16/2007                        YAZ-LOG(7)
Impressum