Perlbal::Manual::Logging - Perlbalのログシステムがどのように動作するか
Perlbal 1.78.
Perlbal は少しのメッセージの記録をサポートします(例えば、プラグインの中でメッセージを記録することができます)。
このドキュメントはそれをどうやるかを説明します。
Perlbalがフォアグラウンドで動作している場合は、printf
の呼び出しで記録します。このことはSTDOUT
で記録を取得しなければならないことを意味します。
Perlbalがバックグラウンドで動作している場合は、Sys::Syslog の manpage を使って記録します。the Sys::Syslog manpage が利用できない場合は、記録されないでしょう。これはPerlbalの記録システムについてもっとも重要なことです。
You can log a message by calling Perlbal::log
as you'd call the Sys::Syslog manpage's syslog
:
Perlbal::log( $priority, $format, @args );
更に詳しい情報については the Sys::Syslog manpage を読むべきですが、例があります:
Perlbal::log( 'info', 'beginning run' );
そして、もう一つの例です:
Perlbal::log( 'crit', "this thing crashed: $!" );
Perlbal::log("crit", "Undef \$fh: $stack_trace");
Perlbal::log('crit', "Error creating socket: $!");
inet_aton
がソケットを作成するのに失敗した場合は、the Perlbal::BackendHTTP manpage がcriticalメッセージを記録します:
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': $!" );
USR1シグナルをperlbalに送信する場合、perlbalはsyslogにいつかの基本的な統計を記録するようにします。
それは管理サービスへの接続と似ていて、 格サービスへの show service
に加えてstates
および queues
コマンドを発行します。
Perlbalが the Sys::Syslog manpage を開く方法で、デフォルトでは /var/log/daemon.log に記録します。
/etc/syslog.confの下の the Sys::Syslog manpage設定を変更することで、調整することができます。詳しくはthe Sys::Syslog manpage を見てください。