1Perlbal::Manual::LogginUgs(e3r)Contributed Perl DocumentPaetrilobnal::Manual::Logging(3)
2
3
4

NAME

6       Perlbal::Manual::Logging - How Perlbal's logging system works
7
8   VERSION
9       Perlbal 1.78.
10
11   DESCRIPTION
12       Perlbal supports logging of a few messages (and you can log your
13       messages in your plugins, for instance).
14
15       This document describes how to achieve that.
16
17   IMPORTANT: foreground vs. background
18       If Perlbal is running on the foreground, it logs by calling "printf",
19       which means you should get the logs on "STDOUT".
20
21       If Perlbal is running on the background, it logs through Sys::Syslog.
22       If Sys::Syslog is not available, there will be no logging, and THAT'S
23       THE MOST IMPORTANT THING TO KNOW ABOUT PERLBAL'S LOGGING SYSTEM.
24
25   How to log a message
26       You can log a message by calling "Perlbal::log" as you'd call
27       Sys::Syslog's "syslog":
28
29           Perlbal::log( $priority, $format, @args );
30
31       You should read the documentation for Sys::Syslog for more information,
32       but here's an example:
33
34           Perlbal::log( 'info', 'beginning run' );
35
36       And here's another example:
37
38           Perlbal::log( 'crit', "this thing crashed: $!" );
39
40   What is logged?
41       •   When we try to read from or write to a filehandle that is
42           undefined, Perlbal::AIO logs a critical message:
43
44               Perlbal::log("crit", "Undef \$fh: $stack_trace");
45
46       •   When failing to create a socket, Perlbal::BackendHTTP logs a
47           critical message:
48
49               Perlbal::log('crit', "Error creating socket: $!");
50
51       •   When "inet_aton" fails to create a socket, Perlbal::BackendHTTP
52           logs a critical message:
53
54               Perlbal::log('crit', "inet_aton failed creating socket for $ip");
55
56       •   When writing to a client, if we try to read more than we should
57           from the backend, Perlbal::ClientHTTPBase logs a warning message:
58
59               Perlbal::log('warning', "tried to readahead negative bytes.  filesize=$self->{reproxy_file_size}, offset=$self->{reproxy_file_offset}");
60
61       •   When opening a file being PUT for writing to disk, if there's an
62           error (which is going to originate a 500 server error),
63           Perlbal::ClientHTTPBase logs a warning message:
64
65               Perlbal::log('warning', "system error: $msg ($info)");
66
67       •   If we receive a request with a content lenght different from the
68           actual length of the request, Perlbal::ClientProxy logs a critical
69           message:
70
71               Perlbal::log('crit', "Content length of $clen declared but $self->{buoutpos} bytes written to disk");
72
73       •   When trying to buffer data to disk, if the operation fails
74           Perlbal::ClientProxy logs a critical message:
75
76               Perlbal::log('crit', "Failure to open $fn for buffered upload output");
77
78       •   After buffering data to disk, if the file is empty,
79           Perlbal::ClientProxy logs a critical message:
80
81               Perlbal::log('crit', "Error writing buffered upload: $!.  Tried to do $len bytes at $self->{buoutpos}.");
82
83       •   When purging a buffered upload on the disk, if an error occurs,
84           Perlbal::ClientProxy logs a critical message:
85
86               Perlbal::log('warning', "Unable to link $self->{bufilename}: $!");
87
88       •   When marking a backend as pending, if there's already another one
89           in that ip/port, Perlbal::Service will log a couple of warning
90           messages:
91
92               Perlbal::log('warning', "Warning: attempting to spawn backend connection that already existed.");
93
94               Perlbal::log('warning', "          -- [$filename:$line] $package::$subroutine");
95
96       •   When deciding whether we should spawn one or more backend
97           connections, if the total of pending conections is negative,
98           Perlbal::Service will log a critical message:
99
100               Perlbal::log('crit', "Bogus: service $self->{name} has pending connect count of $self->{pending_connect_count}?!  Resetting.");
101
102       •   When spawning a backend connection, if there is no IP address for
103           the backend, Perlbal::Service will log a critical message:
104
105               Perlbal::log('crit', "No backend IP for service $self->{name}");
106
107       •   When starting, Perlbal will log an info message:
108
109               Perlbal::log('info', 'beginning run');
110
111       •   When shutting down, Perlbal will log an info message:
112
113               Perlbal::log('info', 'ending run');
114
115       •   After each loop, is some error occurred, Perlbal will log a
116           critical message:
117
118               Perlbal::log('crit', "crash log: $_") foreach split(/\r?\n/, $@);
119
120       •   When attempting to create the pidfile, if unsuccessful, Perlbal
121           will log an info message:
122
123               Perlbal::log('info', "couldn't create pidfile '$file': $!" );
124
125       •   When attempting to write to the pidfile, if unsuccessful, Perlbal
126           will log an info message:
127
128               Perlbal::log('info', "couldn't write into pidfile '$file': $!" );
129
130   Generating more logs by sending a USR1 signal to perlbal
131       If you send a USR1 signal to perlbal, that tells it to log some basic
132       statistics to the syslog.
133
134       It's similar to connecting to a management service and issue a "show
135       service" for each service, plus a "states" and a "queues" commands.
136
137   Where is it logged to?
138       The way Perlbal opens Sys::Syslog, it logs to /var/log/daemon.log by
139       default.
140
141   SEE ALSO
142       You can tweek Sys::Syslog's configuration under /etc/syslog.conf. See
143       Sys::Syslog for more details.
144
145
146
147perl v5.36.0                      2023-01-18       Perlbal::Manual::Logging(3)
Impressum