Perlbal::Manual::Logging(3pm) | User Contributed Perl Documentation | Perlbal::Manual::Logging(3pm) |
Perlbal::Manual::Logging - How Perlbal's logging system works
Perlbal 1.78.
Perlbal supports logging of a few messages (and you can log your messages in your plugins, for instance).
This document describes how to achieve that.
If Perlbal is running on the foreground, it logs by calling "printf", which means you should get the logs on "STDOUT".
If Perlbal is running on the background, it logs through Sys::Syslog. If Sys::Syslog is not available, there will be no logging, and THAT'S THE MOST IMPORTANT THING TO KNOW ABOUT PERLBAL'S LOGGING SYSTEM.
You can log a message by calling "Perlbal::log" as you'd call Sys::Syslog's "syslog":
Perlbal::log( $priority, $format, @args );
You should read the documentation for Sys::Syslog for more information, but here's an example:
Perlbal::log( 'info', 'beginning run' );
And here's another example:
Perlbal::log( 'crit', "this thing crashed: $!" );
Perlbal::log("crit", "Undef \$fh: $stack_trace");
Perlbal::log('crit', "Error creating socket: $!");
Perlbal::log('crit', "inet_aton failed creating socket for $ip");
Perlbal::log('warning', "tried to readahead negative bytes. filesize=$self->{reproxy_file_size}, offset=$self->{reproxy_file_offset}");
Perlbal::log('warning', "system error: $msg ($info)");
Perlbal::log('crit', "Content length of $clen declared but $self->{buoutpos} bytes written to disk");
Perlbal::log('crit', "Failure to open $fn for buffered upload output");
Perlbal::log('crit', "Error writing buffered upload: $!. Tried to do $len bytes at $self->{buoutpos}.");
Perlbal::log('warning', "Unable to link $self->{bufilename}: $!");
Perlbal::log('warning', "Warning: attempting to spawn backend connection that already existed."); Perlbal::log('warning', " -- [$filename:$line] $package::$subroutine");
Perlbal::log('crit', "Bogus: service $self->{name} has pending connect count of $self->{pending_connect_count}?! Resetting.");
Perlbal::log('crit', "No backend IP for service $self->{name}");
Perlbal::log('info', 'beginning run');
Perlbal::log('info', 'ending run');
Perlbal::log('crit', "crash log: $_") foreach split(/\r?\n/, $@);
Perlbal::log('info', "couldn't create pidfile '$file': $!" );
Perlbal::log('info', "couldn't write into pidfile '$file': $!" );
If you send a USR1 signal to perlbal, that tells it to log some basic statistics to the syslog.
It's similar to connecting to a management service and issue a "show service" for each service, plus a "states" and a "queues" commands.
The way Perlbal opens Sys::Syslog, it logs to /var/log/daemon.log by default.
You can tweek Sys::Syslog's configuration under /etc/syslog.conf. See Sys::Syslog for more details.
2015-05-16 | perl v5.20.2 |