Skip to content

Latest commit

 

History

History
245 lines (149 loc) · 6.34 KB

File metadata and controls

245 lines (149 loc) · 6.34 KB

������

Log::Common - httpd��勉�≪�壔�祉�鴻�㏍�医就綣���������í�若�㏍�医就綣���с�㏍�違����阪�������障��

网�荀�

use Log::Common;

$l = new Log::Common(access => "/var/log/search-hits",
                     error  => "/usr/local/log/error_log",
                     no_stderr => 1,
                     class => "debug");

$l->error(message => "Uh-oh... :-(", fatal => 1);
$l->access(user => "martin", message => "$query_string",
             code => 200);

茯㋛�

�����勉�壔�í�鴻�壔��Apache���NCSA WWW��泣�若����若�˨����c�☎境�����������⓾����� httpd��演����㏍�違����<�ゃ��綵√����勉�≪�壔�祉�鴻�祉�㏍�違����<�ゃ�˨� �����í�若�祉�㏍�違����<�ゃ�˨����阪����������������˩戎��������������с�����2��ゃ�勉�<�純�������� 絎�臂í����⓾����障����������勉�㏍�違�祉����<�ゃ�˨�壩�吾��莨若�障�����������茲���違�勉����㏍�祉�鴻�� �����������<�ゃ�˨�������������吾��莨若�������������������������帥����������������㏍����壔�������障����� 箴水��筝����筝≧�鴻�勉�<�純�������壔�����絎������������������㏍�違�í�������泣�c����違���������� "exit"�����若�喝�冴�������í�<�若�帥����泣����若�������⓾����障�����

��医��紊����GATEWAY_INTERFACE���荐㊤����������⓾����ŝ�������違�������í�若�<����祉�若�吾� STDERR��˨�������������障�����- �����障�������ŝ�������違�������勐��������筝���吾����������������� ��с����障�������������勉�������������勉�壔�í�鴻��篏帥�c�⓾�����Perl�����㏍�違�í���� 罐究�勰�����綵若����勉����潟����⓾�若�吟����激�鴻�������祉�㏍�違����<�ゃ�˨�勌検��鴻���������� ��<����祉�若�吾����阪�������������������с����障�����

�����í�若�祉�㏍�違����<�ゃ�˨�祉����潟����ŝ�壠�演�����HTTP��泣�若����勐�ñ�◒������������� UTC��帥�ゃ����鴻�帥�潟�����篁������������☗�阪����������障�����

��<�純�����

access( [ OPTIONS ] );
error( [ OPTIONS ] );

�����í�<�若�

Log::Common��ŝ����吾�с�壔�����������������������:

access => ��≪�壔�祉�刻愁��㏍�逸愁�����<�ゃ�����

access��<�純����������������⓾�㏍�医�阪����������������˩戎��������������<�ゃ��������

error => �����í�種愁��㏍�逸愁�����<�ゃ�����

error��<�純����������������⓾�㏍�医�阪����������������˩戎��������������<�ゃ��������

class => ��壔�í�劫��

�����í�若�祉�㏍�違�<����祉�若�吾�с�勉�������í�˨����勉�壔�í�鴻�������������井����宴�� ��祉�㏍�ャ�ŝ����i�∫�f����宴��WWW��泣�若����������勉�<����祉�若�吾����<�若�˨�激�鴻������������� ��<����祉�若�吾�ŝ�í����阪�ャ�������������˩戎��������������с����障����������勉�������í�˨����ゃ� ���������error��㏍�医�阪����<�純�������勐�若�喝�冴����т����吾����������������с����障�����

no_stderr => 0 or 1

������1��̬┃絎����������������STDERR��吾�勉�<����祉�若�醐����勐�阪��������罩≪����障����� ��������í�˨�����0��с��������������error��<�純����������若�喝�冴����������˩����吾�������� �����������с����障�����

筝≧�鴻�勉�<����祉�若�吾����演��:

fatal => 腟�篋���潟�若��

��������壚�������翫�順����ŝ����í�若����榊�����������������腓冴�������㏍�違�祉����<�ゃ�˨� �����潟����ŝ����阪�����������緇���������㏍�違�í�����croak��������������障����� 筝���������������ゃ�壔����㏍�違�í����勛��篋���潟�若����������☖戎��������障����� 鐚�荐活��羈�:croak��壩��羣���≪�吾�ャ�若�� Carp��у��臂í�������⓾�������∽�違�� die������������篌若�⓾����障�������阪����������������宴����違�ŝ����障��)

message => ��<����祉�若�御��絖����

��㏍�違����<�ゃ�˨����阪�����������絎������勉�<����祉�若�吾��

access��<�純�����絨����:

count => ��医��

���絽吾�虁拶�����������������ゃ����� - 筝������������ŝ��������0���

code => 綽�膈���潟�若��

���絽吾�虁拶�����������������ゃ����� - 筝������������ŝ��������0��� (荐活��羈Ǎ��筝�荐����count��勤ą��������������˨�ŝ�c�⓾����障�c�⓾�������� ��������������壔��������絽吾�壠��膈���潟�若�� - 筝������������ŝ��������0������鐚�

host => �����鴻�����

��若�喝�冴��/��壔�í�ゃ�≪�潟����祉����鴻����勉����<�ゃ�喝��������������IP��≪����㋘�鴻�������� 筝������������ŝ�������違�������㏍�祉�合�医��紊���違�с��REMOTE_HOST���REMOTE_ADDR (CGI��˨����c�☀┃絎���������⓾��������������)��������ŝ�˨����с����壔�������障����� �����������勉�í�<�������ŝ�������違����㏍�違�祉����<�ゃ�˨�с�勉����勉����c�若�˨���� 0.0.0.0��̬┃絎���������障�����

ident => ident罎�膣≪�勐��

���絽吾�壠�若�喝�冴�������鴻����������若����˨�ゃ����⓾��IDENT(AUTH)罎�膣≪�勛�������勐�ゃ�� 筝������������ŝ�������違�������㏍�祉�合�医����с��REMOTE_IDENT��勐�ゃ��篏帥�������������� "-"��с�����

user => 茯�荐若����������⓾�若�九��

���絽吾�壔��箴������医�堺��HTTP茯�荐若��篏帥�c�☀��荐若����������⓾�若�九�����筝������������ŝ�������違�� 篁c�������˨����㏍�祉�合�医����с��REMOTE_USER��勐�ゃ��篏帥��������������"-"��с�����

error��<�純�����絨����:

class => ��壔�í�劫��

�����勐�若�喝�冴����������˨�������í�˨��荐㊤�����筝���吾�������障�� - 筝�荐�������荀с��������������

info => �����掩��絖����

菴遵����勖����� - ��������壔�㏍�違����<�ゃ�˨�勉����勤����勖��緇���˩幻��㋚磁��у�蚊�障���� ��吾�������障�����

no_stderr => 0 or 1

�����勐�若�喝�冴����������˨�������í�˨��荐㊤�����筝���吾�������障�� - 筝�荐�������荀с��������������

�����<�ゃ�˨�祉����í�若��������

�����������壠�演����勉����c�若�˨����ñ��羈���с��������������羈���������⓾����������� - �����������c�若�˨���� 絲障����☗����������勉����������ŝ�������ŝ����ŝ�������������������壔�������障���������������������������� ��㏍�違����<�ゃ�˨����√�����HTTP��泣�若����若�祉�㏍�違����<�ゃ�̬В��������若�˨��篏帥�c�☗�☎�������� ��ゃ�������с�������違����������������祉�����膂≦����с�����������

�����í�若�祉�㏍�違����<�ゃ�˨�壚札筝���勉�������ʋ�������˨�ŝ����障�� :-

��ヤ��

���������gmtime��∽�違��篏帥�c��GMT(UTC)��ф�眼����������☗�阪�����������茹���㋚磁�� ��蚊�障����⓾����障�������������壠幻��˨����ŝ����˩撮��c�☎�������������障�����

��<����祉�若�吾�勉�壔�í��

�����勐�������˨�壔�潟�㏍�恰��絖�':'�����ゃ����障�����class�����í�<�若�帥��������緇� ��������障�������������壠��篏���������⓾�ŝ����吾�с�壔����̬┃絎������������������í�˨����ゃ�� 筝���吾�������障�����

篁�絮���勖�����

info���������緇���������障�������������壚幻��㋚磁��˨����c�☗�蚊�障����障�����

��≪�壔�祉�刻愁��㏍�違����<�ゃ�˨�壚札筝���勉�������ʋ�������˨�ŝ����障�� :-

��壔�í�ゃ�≪�潟����祉����鴻�����/IP��≪����㋘��

host�����í�<�若�帥��������緇���������障�����

��ŝ�≪�若����祉�⓾�若�九��

ident�����í�<�若�帥��������緇���������障�������������奝��絽吾�� AUTH/IDENT�����㏍����潟�� - RFC 1413, RFC 931�����������☀����ゃ����������障�����

��ŝ�≪�若����祉�⓾�若�九��

user�����í�<�若�帥��������緇���������障�������������奝��絽吾��HTTP茯�荐若�������勉����勉�с�����

��帥�ゃ����鴻�帥�潟��

localtime���篏帥�����GMT (UTC)��ŝ����祉����������ゃ����☎�������������障������������� 茹���㋚磁��˨����c�☗�蚊�障�����絽吾�˨����ŝ����˩撮�����c�☀�ɱ�������̥�������������障�����

��<����祉�若�吾����勉�����

message�����í�<�若�帥��������緇���������障�����

綽�膈���鴻����若�帥�鴻�祉�潟�若��

code�����í�<�若�帥��������緇���������障��������絽吾�壩�医�ゃ�с�����

荵∫����������������ゃ����祉�˨�⓾�潟��

count�����í�<�若�帥��������緇���������障��������絽吾�壩�医�ゃ�с�����

�����

��������障����� ? :-)

TODO

��㏍�違����<�ゃ�˨�祉����í�若��������(紊����X�����㏍�違����<�ゃ�˨�祉����潟����ŝ�с�勉����c�若�˨��Y ��������⓾����潟��)�����≦宍���������箴水�í�������������障��������

���篏�罔�(=COPYRIGHT)

Copyright (c) 1998 Martin Hamilton <martinh@gnu.org> and Jon Knight <jon@net.lut.ac.uk>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

It was developed by the Department of Computer Studies at Loughborough University of Technology, as part of the ROADS project. This work was funded by the Joint Information Systems Committee (JISC) of the Higher Education Funding Councils under the UK Electronic Libraries Programme (eLib), the European Commission DESIRE project, and the TERENA development programme.

篏����(=AUTHORS)

Jon Knight <jon@net.lut.ac.uk>
Martin Hamilton <martinh@gnu.org>

膺肢┳���

綏����絖����(GCD00051@nifty.ne.jp)