This file is indexed.

/usr/share/doc/lprng-doc/LPRng-Reference-Multipart/x3929.htm is in lprng-doc 3.8.A~rc2-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 6 November 2007), see www.w3.org">

  <title>Debugging, Tracing, and Log Files</title>
  <meta name="GENERATOR" content=
  "Modular DocBook HTML Stylesheet Version 1.79">
  <link rel="HOME" title=" LPRng Reference Manual" href=
  "index.htm">
  <link rel="UP" title="Print Spooling Tutorial " href=
  "tutorial.htm">
  <link rel="PREVIOUS" title="Interfacing to Non-LPRng Spoolers"
  href="x3897.htm">
  <link rel="NEXT" title=
  "LPRng Clients - lpr, lprm, lpq, lpc, lpstat " href=
  "lprngclients.htm">
</head>

<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF"
vlink="#840084" alink="#0000FF">
  <div class="NAVHEADER">
    <table summary="Header navigation table" width="100%" border=
    "0" cellpadding="0" cellspacing="0">
      <tr>
        <th colspan="3" align="center">LPRng Reference Manual: 24
        Sep 2004 (For LPRng-3.8.28)</th>
      </tr>

      <tr>
        <td width="10%" align="left" valign="bottom"><a href=
        "x3897.htm" accesskey="P">Prev</a></td>

        <td width="80%" align="center" valign="bottom">Chapter 4.
        Print Spooling Tutorial</td>

        <td width="10%" align="right" valign="bottom"><a href=
        "lprngclients.htm" accesskey="N">Next</a></td>
      </tr>
    </table>
    <hr align="left" width="100%">
  </div>

  <div class="SECT1">
    <h1 class="SECT1"><a name="AEN3929" id="AEN3929">4.21.
    Debugging, Tracing, and Log Files</a></h1>

    <p>The <b class="APPLICATION">LPRng</b> software was designed
    and written to provide as high a level of diagnostic
    information as possible. This was largely in part due to the
    problems with portability, coding errors, and other human
    frailties. Approximately 80% of the <b class=
    "APPLICATION">LPRng</b> source code concerns itself with
    checking return values from system functions and producing
    error messages, debugging and tracing information, and various
    facilities used for regression testing and diagnosis.</p>

    <p>The approach used by <b class="APPLICATION">LPRng</b> is to
    produce <span class="emphasis"><i class=
    "EMPHASIS">trace</i></span> output for the <b class=
    "APPLICATION">LPRng</b> clients or <span class=
    "emphasis"><i class="EMPHASIS">log</i></span> files for the
    <b class="APPLICATION">lpd</b> server that show the various
    events or flow of information through the <b class=
    "APPLICATION">LPRng</b> system. There are several classes or
    types of actions that can be traced, and various levels of
    trace information generated. The interface used to control
    these actions are the command line <tt class="LITERAL">-D
    literals</tt> flags and the <tt class="COMMAND">lpc debug</tt>
    command.</p>

    <p>First, we will look at how you can use the debugging
    facilities for the clients. Enter the following commands:</p>

    <div class="INFORMALEXAMPLE">
      <a name="AEN3944" id="AEN3944"></a>
      <pre class="SCREEN">
<samp class="PROMPT">h4: {292} % </samp><kbd class=
"USERINPUT">lpr -D=</kbd>
debug usage: -D [ num | key=num | key=str | flag | flag@ | flag+N ]*
  keys recognized: network[+N,@], database[+N,@], lpr[+N,@],
   lpc[+N,@], lprm[+N,@], lpq[+N,@], test=num, job=num, log[+N,@]
<samp class="PROMPT">h4: {293} % </samp><kbd class=
"USERINPUT">lpr -V /tmp/hi</kbd>
LPRng-3.7.2, Copyright 1988-2000 Patrick Powell, &lt;papowell@lprng.com&gt;
sending job 'papowell@h4+981' to lp@localhost
connecting to 'localhost', attempt 1
connected to 'localhost'
requesting printer lp@localhost
sending control file 'cfA981h4.private' to lp@localhost
completed sending 'cfA981h4.private' to lp@localhost
sending data file 'dfA981h4.private' to lp@localhost
completed sending 'dfA981h4.private' to lp@localhost
done job 'papowell@h4+981' transfer to lp@localhost
<samp class="PROMPT">h4: {294} % </samp><kbd class=
"USERINPUT">lpr -D1 /tmp/hi</kbd>
09:38:08.707 h4 [13991] lpr  Get_printer: original printer '&lt;NULL&gt;'
09:38:08.708 h4 [13991] lpr  Get_all_printcap_entries: starting
09:38:08.708 h4 [13991] lpr  Select_pc_info: looking for 'all', depth 0
09:38:08.708 h4 [13991] lpr  Select_pc_info: returning '&lt;NULL&gt;'
09:38:08.708 h4 [13991] lpr  Select_pc_info: looking for '*', depth 0
09:38:08.708 h4 [13991] lpr  Select_pc_info: returning '&lt;NULL&gt;'
09:38:08.708 h4 [13991] lpr  Dump_line_list: Get_all_printcap_entries
...
</pre>
    </div>

    <p>The <tt class="COMMAND">lpr -D=</tt> causes the <b class=
    "APPLICATION">lpr</b> (and other <b class=
    "APPLICATION">LPRng</b> programs) to show what debugging flags
    are available. The <tt class="COMMAND">lpr -V</tt> flag causes
    <b class="APPLICATION">lpr</b> to run in verbose mode and show
    its activities. Finally, we use <tt class="COMMAND">lpr
    -D1</tt> to enable the simplest level of debugging. This will
    produce a trace of the various activities that <b class=
    "APPLICATION">lpr</b> carries out. Try <tt class="COMMAND">lpr
    -D2</tt>, <tt class="COMMAND">lpr -D3</tt>, and so forth to see
    the increasing amount of detail that you get.</p>

    <p>The <span class="emphasis"><i class=
    "EMPHASIS">network</i></span> and <span class=
    "emphasis"><i class="EMPHASIS">database</i></span> debug flags
    turn on debugging for the network facilities and the database
    (<tt class="FILENAME">lpd.conf</tt>, <tt class=
    "FILENAME">printcap</tt>, and <tt class=
    "FILENAME">lpd.perms</tt>) lookups. Lets see what <tt class=
    "COMMAND">lpr -Dnetwork</tt> shows us:</p>

    <div class="INFORMALEXAMPLE">
      <a name="AEN3969" id="AEN3969"></a>
      <pre class="SCREEN">
C<samp class="PROMPT">h4: {295} % </samp><kbd class=
"USERINPUT">lpr -Dnetwork /tmp/hi</kbd>
lp: getconnection: START host localhost, timeout 10, connection_type 1
lp: getconnection: fqdn found localhost.private, h_addr_list count 1
lp: Link_dest_port_num: port 2000 = 2000
lp: getconnection: sock 3, src ip 127.0.0.1, port 65209
lp: getconnection: dest ip 127.0.0.1, port 2000
lp: getconnection: connection to 'localhost' sock 3, errmsg 'No Error'
lp: Link_send: host 'localhost' socket 3, timeout 6000
lp: Link_send: str '^Blp
', count 4, ack 0x80447a0
lp: Link_send: final status NO ERROR
lp: Link_send: host 'localhost' socket 3, timeout 6000
lp: Link_send: str '^B135 cfA276h4.private
', count 22, ack 0x8044370
lp: Link_send: final status NO ERROR
lp: Link_send: host 'localhost' socket 3, timeout 6000
lp: Link_send: str 'Hh4.private
Ppapowell
J/tmp/hi
CA
Lpapowell
Apapowell@h4+276
D2000-06-02-09:44:52.369
Qlp
N/tmp/hi
fdfA276h4.private
UdfA276h4.private
', count 136, ack 0x8044370
lp: Link_send: final status NO ERROR
lp: Link_send: host 'localhost' socket 3, timeout 6000
lp: Link_send: str '^C3 dfA276h4.private
', count 20, ack 0x8044310
lp: Link_send: final status NO ERROR
lp: Link_send: host 'localhost' socket 3, timeout 6000
lp: Link_send: str '', count 1, ack 0x8044310
lp: Link_send: final status NO ERROR
</pre>
    </div>

    <p>As we see, we get a detailed exposition of the network
    connection and transfer steps. If you need or want more detail,
    try using <tt class="COMMAND">lpr -Dnetwork+2</tt> or
    <tt class="COMMAND">lpr -Dnetwork+3</tt>. You may want to try
    <tt class="COMMAND">lpr -Ddatabase</tt> and observe the actions
    of the <b class="APPLICATION">lpr</b> program as it extracts
    information from the <tt class="FILENAME">lpd.conf</tt> and
    <tt class="FILENAME">printcap</tt> files. If you need or want
    more detail, try using <tt class="COMMAND">lpr
    -Ddatabase+2</tt> or <tt class="COMMAND">lpr
    -Ddatabase+3</tt>.</p>

    <p>If you need to trace the activities of the <b class=
    "APPLICATION">lpd</b> server, it becomes a little more complex.
    The lpd server has a single <span class="emphasis"><i class=
    "EMPHASIS">listening</i></span> process that forks and creates
    individual processes to handle incoming requests. Debug or
    diagnose the main process actions by using <tt class=
    "COMMAND">lpd -D...</tt>. You may also want to use <tt class=
    "COMMAND">lpd -F</tt> to keep the server in the foreground so
    you can kill it off easily. Needless to say, you should also
    redirect the <acronym class="ACRONYM">STDERR</acronym> and
    <acronym class="ACRONYM">STDOUT</acronym> so that it goes to a
    file so that you can examine the voluminous records at your
    leisure. The following shows a typical main <b class=
    "APPLICATION">lpd</b> process debugging session using the C
    Shell.</p>

    <div class="INFORMALEXAMPLE">
      <a name="AEN3990" id="AEN3990"></a>
      <pre class="SCREEN">
<samp class="PROMPT">h4: {296} % </samp><kbd class=
"USERINPUT">lpd -F -D1 &gt;&amp;/tmp/logfile &amp;</kbd>
[2] 14299
<samp class="PROMPT">h4: {297} % </samp><kbd class=
"USERINPUT">tail -f /tmp/logfile</kbd>
2000-06-02-09:53:39.716 h4 [1200] Waiting Read_server_status: \
                         select status 1
2000-06-02-09:53:39.716 h4 [1200] Waiting Read_server_status: \
                         read status 1
2000-06-02-09:53:39.716 h4 [1200] Waiting Dump_line_list: \
    Read_server_status - input - 0x8047980, count 0, max 0, list 0x0
2000-06-02-09:53:39.716 h4 [1200] Waiting Read_server_status: \
                         select status 0
2000-06-02-09:53:39.716 h4 [1200] Waiting lpd: LOOP START
2000-06-02-09:53:39.716 h4 [1200] Waiting Get_max_servers: \ 
                         getrlimit returns 64
2000-06-02-09:53:39.716 h4 [1200] Waiting Get_max_servers: \
                         returning 32
2000-06-02-09:53:39.716 h4 [1200] Waiting lpd: \
                         max_servers 32, active 0
2000-06-02-09:53:39.716 h4 [1200] Waiting lpd: \
                         starting select timeout 'yes'

^C
<samp class="PROMPT">h4: {298} % </samp><kbd class=
"USERINPUT">jobs</kbd>
[1]  - Running                lpd -F -D1 &gt;&amp; /tmp/logfile
<samp class="PROMPT">h4: {299} % </samp><kbd class=
"USERINPUT">kill %1</kbd>
</pre>
    </div>

    <p>We start the debugging session by running the <b class=
    "APPLICATION">lpd</b> server in foreground mode. This causes it
    to send its output to <acronym class="ACRONYM">STDOUT</acronym>
    and <acronym class="ACRONYM">STDERR</acronym>. We redirect both
    of these to a file and put the <b class="APPLICATION">lpd</b>
    server in the background. Then we use <tt class="COMMAND">tail
    -f</tt> to read from the log file. Finally, we kill off the
    <b class="APPLICATION">lpd</b> server.</p>

    <p>This method is extremely difficult to use, as all of the
    output produced by the server and its subprocesses is sent to a
    single output file. If we want to debug the actions concerning
    a single queue, then we can use the queue <span class=
    "emphasis"><i class="EMPHASIS">log file</i></span> and
    <tt class="COMMAND">lpc debug</tt> command instead. The
    following options control debugging of an individual print
    queue.</p>

    <div class="VARIABLELIST">
      <dl>
        <dt>lf=log</dt>

        <dd>
          <p>The log file for the queue. The queue server process
          will open this file and place debugging information into
          this file.</p>
        </dd>

        <dt>max_log_file_size=nnn</dt>

        <dd>
          <p>The maximum size of the log file in K bytes. When the
          queue server process first opens this file it will check
          to see if the file is larger than the maximum size. If it
          is, then it will truncate it. A zero (0) value suppress
          truncation.</p>
        </dd>

        <dt>min_log_file_size=nnn</dt>

        <dd>
          <p>When the log file is truncated only the the last nnn K
          bytes are retained.</p>
        </dd>

        <dt>db=options</dt>

        <dd>
          <p>These are debugging options for the spool queue. These
          options are permanent and cannot be changed by using the
          <tt class="COMMAND">lpc debug</tt> facility.</p>
        </dd>
      </dl>
    </div>

    <p>The <tt class="COMMAND">lpc debug</tt> command is used to
    set the debugging options in force for the spool queue. This is
    done by writing the debug options into the spool queue control
    file. Let us see how we can use this facility to trace the
    actions of printing a file.</p>

    <p>Edit the printcap file so it have the contents indicated
    below, create the <tt class="FILENAME">/tmp/lp</tt> and
    <tt class="FILENAME">/tmp/lp2</tt> files with <tt class=
    "LITERAL">0777</tt> permissions. Use <tt class=
    "COMMAND">checkpc -f</tt> to check the printcap, and then use
    <tt class="COMMAND">lpc reread</tt> to restart the <b class=
    "APPLICATION">lpd</b> server.</p>

    <div class="INFORMALEXAMPLE">
      <a name="AEN4037" id="AEN4037"></a>
      <pre class="SCREEN">
# printcap
lp:force_localhost
lp:server
  :lp=/dev/null
  :sd=/var/spool/lpd/%P
  :lf=log
lp2:force_localhost
lp2:server
  :sd=/var/spool/lpd/%P
  :lp=/tmp/lp2
  :lf=log
</pre>
    </div>

    <p>Now execute the following commands:</p>

    <div class="INFORMALEXAMPLE">
      <a name="AEN4040" id="AEN4040"></a>
      <pre class="SCREEN">
<samp class="PROMPT">h4: {300} % </samp><kbd class=
"USERINPUT">lpq</kbd>
Printer: lp@h4
 Queue: no printable jobs in queue
<samp class="PROMPT">h4: {301} % </samp><kbd class=
"USERINPUT">lpc debug lp 1</kbd>
Printer: lp@h4
debugging override set to '1'
lp@h4.private: updated
<samp class="PROMPT">h4: {302} % </samp><kbd class=
"USERINPUT">lpc status</kbd>
 Printer Printing Spooling Jobs Server Subserver Redirect Status/(Debug)
lp@h4    enabled  enabled    0    none    none          (1)
<samp class="PROMPT">h4: {303} % </samp><kbd class=
"USERINPUT">lpr /tmp/hi</kbd>
<samp class="PROMPT">h4: {304} % </samp><kbd class=
"USERINPUT">more /var/spool/lpd/lp2/log</kbd>
2000-06-02-10:10:50.589 h4 [1201] (Server) lp: \
   Update_spool_info: printer 'lp'
2000-06-02-10:10:50.590 h4 [1201] (Server) lp: \
   Do_queue_jobs: printable 1, held 0, move 0
2000-06-02-10:10:50.590 h4 [1201] (Server) lp: \
   Do_queue_jobs: after Scan_queue next fd 5
2000-06-02-10:10:50.590 h4 [1201] (Server) lp: \
   Do_queue_jobs: MAIN LOOP
2000-06-02-10:10:50.590 h4 [1201] (Server) lp: \
   Do_queue_jobs: Susr1 before scan 0
2000-06-02-10:10:50.591 h4 [1201] (Server) lp: \
   Do_queue_jobs: chooser '&lt;NULL&gt;', chooser_routine 0
</pre>
    </div>

    <p>The <tt class="COMMAND">lpc debug</tt> command sets the
    debug level to 1. We can use the <tt class="COMMAND">lpc
    status</tt> command to see what debug flags or actions are
    currently specified for the spool queue. We then send a job to
    the spool queue and examine the log file contents.</p>

    <p>Each line in the log file has a timestamp, the name of the
    host, the process id that produced it, and a heading that tells
    the action or activity that the process is performing, and the
    name of the print queue that is being processed and a trace
    message. By convention, the trace message lists the name of the
    routine that processed it and then the actual information. Some
    messages may extend over several lines, but each line has the
    standard header at the start of the line.</p>

    <p>The default debug or trace actions were designed to trace
    problems with printing, as these are the most common. However,
    you can also use the <b class="APPLICATION">lpr</b>, <b class=
    "APPLICATION">lpc</b>, <b class="APPLICATION">lprm</b>, or
    <b class="APPLICATION">lpq</b> option to cause the <b class=
    "APPLICATION">lpd</b> server to trace the actions during the
    execution of an <b class="APPLICATION">lpr</b>, <b class=
    "APPLICATION">lpc</b>, <b class="APPLICATION">lprm</b>, or
    <b class="APPLICATION">lpq</b> request.</p>

    <p>The <span class="emphasis"><i class=
    "EMPHASIS">log</i></span> option is used to test various
    logging facilities and is usually not used for general purpose
    debugging.</p>
  </div>

  <div class="NAVFOOTER">
    <hr align="left" width="100%">

    <table summary="Footer navigation table" width="100%" border=
    "0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="33%" align="left" valign="top"><a href=
        "x3897.htm" accesskey="P">Prev</a></td>

        <td width="34%" align="center" valign="top"><a href=
        "index.htm" accesskey="H">Home</a></td>

        <td width="33%" align="right" valign="top"><a href=
        "lprngclients.htm" accesskey="N">Next</a></td>
      </tr>

      <tr>
        <td width="33%" align="left" valign="top">Interfacing to
        Non-LPRng Spoolers</td>

        <td width="34%" align="center" valign="top"><a href=
        "tutorial.htm" accesskey="U">Up</a></td>

        <td width="33%" align="right" valign="top"><b class=
        "APPLICATION">LPRng</b> Clients - lpr, lprm, lpq, lpc,
        lpstat</td>
      </tr>
    </table>
  </div>

  <p align="center"></p>
</body>
</html>