⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apache2::log.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 2 页
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings.  \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote.  \*(C+ will.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\.    ds -- \(*W-.    ds PI pi.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch.    ds L" "".    ds R" "".    ds C` "".    ds C' ""'br\}.el\{\.    ds -- \|\(em\|.    ds PI \(*p.    ds L" ``.    ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el       .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD.  Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\.    de IX.    tm Index:\\$1\t\\n%\t"\\$2"...    nr % 0.    rr F.\}.el \{\.    de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear.  Run.  Save yourself.  No user-serviceable parts..    \" fudge factors for nroff and troff.if n \{\.    ds #H 0.    ds #V .8m.    ds #F .3m.    ds #[ \f1.    ds #] \fP.\}.if t \{\.    ds #H ((1u-(\\\\n(.fu%2u))*.13m).    ds #V .6m.    ds #F 0.    ds #[ \&.    ds #] \&.\}.    \" simple accents for nroff and troff.if n \{\.    ds ' \&.    ds ` \&.    ds ^ \&.    ds , \&.    ds ~ ~.    ds /.\}.if t \{\.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u".    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}.    \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E.    \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'.    \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\.    ds : e.    ds 8 ss.    ds o a.    ds d- d\h'-1'\(ga.    ds D- D\h'-1'\(hy.    ds th \o'bp'.    ds Th \o'LP'.    ds ae ae.    ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "mod_perl-2.0.2::docs::api::Apache2::Log 3".TH mod_perl-2.0.2::docs::api::Apache2::Log 3 "2005-10-21" "perl v5.10.0" "User Contributed Perl Documentation".\" For nroff, turn off justification.  Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"Apache2::Log \- Perl API for Apache Logging Methods.SH "Synopsis".IX Header "Synopsis".Vb 3\&  # in startup.pl\&  #\-\-\-\-\-\-\-\-\-\-\-\-\-\-\&  use Apache2::Log;\&  \&  use Apache2::Const \-compile => qw(OK :log);\&  use APR::Const    \-compile => qw(:error SUCCESS);\&  \&  my $s = Apache2::ServerUtil\->server;\&  \&  $s\->log_error("server: log_error");\&  $s\->log_serror(_\|_FILE_\|_, _\|_LINE_\|_, Apache2::Const::LOG_ERR,\&                 APR::Const::SUCCESS, "log_serror logging at err level");\&  $s\->log_serror(Apache2::Log::LOG_MARK, Apache2::Const::LOG_DEBUG,\&                 APR::Const::ENOTIME, "debug print");\&  Apache2::ServerRec\->log_error("routine warning");\&  \&  Apache2::ServerRec::warn("routine warning");\&\&  # in a handler\&  #\-\-\-\-\-\-\-\-\-\-\-\-\-\&  package Foo;\&  \&  use strict;\&  use warnings FATAL => \*(Aqall\*(Aq;\&  \&  use Apache2::Log;\&  \&  use Apache2::Const \-compile => qw(OK :log);\&  use APR::Const    \-compile => qw(:error SUCCESS);\&  \&  sub handler {\&      my $r = shift;\&      $r\->log_error("request: log_error");\&  \&      my $rlog = $r\->log;\&      for my $level qw(emerg alert crit error warn notice info debug) {\&          no strict \*(Aqrefs\*(Aq;\&          $rlog\->$level($package, "request: $level log level");\&      }\&  \&      # can use server methods as well\&      my $s = $r\->server;\&      $s\->log_error("server: log_error");\&  \&      $r\->log_rerror(Apache2::Log::LOG_MARK, Apache2::Const::LOG_DEBUG,\&                     APR::Const::ENOTIME, "in debug");\&  \&      $s\->log_serror(Apache2::Log::LOG_MARK, Apache2::Const::LOG_INFO,\&                     APR::Const::SUCCESS, "server info");\&  \&      $s\->log_serror(Apache2::Log::LOG_MARK, Apache2::Const::LOG_ERR,\&                     APR::Const::ENOTIME, "fatal error");\&  \&      $r\->log_reason("fatal error");\&      $r\->warn(\*(Aqroutine request warning\*(Aq);\&      $s\->warn(\*(Aqroutine server warning\*(Aq);\&  \&      return Apache2::Const::OK;\&  }\&  1;\&\&  # in a registry script\&  # httpd.conf: PerlOptions +GlobalRequest\&  use Apache2::ServerRec qw(warn); # override warn locally\&  print "Content\-type: text/plain\en\en";\&  warn "my warning";.Ve.SH "Description".IX Header "Description"\&\f(CW\*(C`Apache2::Log\*(C'\fR provides the Perl \s-1API\s0 for Apache logging methods..PPDepending on the the current \f(CW\*(C`LogLevel\*(C'\fR setting, only logging withthe same log level or higher will be loaded. For example if thecurrent \f(CW\*(C`LogLevel\*(C'\fR is set to \fIwarning\fR, only messages with log levelof the level \fIwarning\fR or higher (\fIerr\fR, \fIcrit\fR, \fIelert\fR and\&\fIemerg\fR) will be logged. Therefore this:.PP.Vb 2\&  $r\->log_rerror(Apache2::Log::LOG_MARK, Apache2::Const::LOG_WARNING,\&                 APR::Const::ENOTIME, "warning!");.Ve.PPwill log the message, but this one won't:.PP.Vb 2\&  $r\->log_rerror(Apache2::Log::LOG_MARK, Apache2::Const::LOG_INFO,\&                 APR::Const::ENOTIME, "just an info");.Ve.PPIt will be logged only if the server log level is set to \fIinfo\fR or\&\fIdebug\fR. \f(CW\*(C`LogLevel\*(C'\fR is set in the configuration file, but can bechanged using the\&\f(CW\*(C`$s\->loglevel()\*(C'\fRmethod..PPThe filename and the line number of the caller are logged only if\&\f(CW\*(C`Apache2::Const::LOG_DEBUG\*(C'\fR is used (because that's how Apache 2.0 loggingmechanism works)..PPNote: On Win32 Apache attempts to lock all writes to a file wheneverit's opened for append (which is the case with logging functions), asUnix has this behavior built-in, while Win32 does not. Therefore\&\f(CW\*(C`Apache2::Log\*(C'\fR functions could be slower than Perl's \fIprint()\fR/\fIwarn()\fR..SH "Constants".IX Header "Constants"Log level constants can be compiled all at once:.PP.Vb 1\&  use Apache2::Const \-compile => qw(:log);.Ve.PPor individually:.PP.Vb 1\&  use Apache2::Const \-compile => qw(LOG_DEBUG LOG_INFO);.Ve.Sh "LogLevel Constants".IX Subsection "LogLevel Constants"The following constants (sorted from the most severe level to theleast severe) are used in logging methods to specify the log level atwhich the message should be logged:.PP\fI\f(CI\*(C`Apache2::Const::LOG_EMERG\*(C'\fI\fR.IX Subsection "Apache2::Const::LOG_EMERG".PP\fI\f(CI\*(C`Apache2::Const::LOG_ALERT\*(C'\fI\fR.IX Subsection "Apache2::Const::LOG_ALERT".PP\fI\f(CI\*(C`Apache2::Const::LOG_CRIT\*(C'\fI\fR.IX Subsection "Apache2::Const::LOG_CRIT".PP\fI\f(CI\*(C`Apache2::Const::LOG_ERR\*(C'\fI\fR.IX Subsection "Apache2::Const::LOG_ERR".PP\fI\f(CI\*(C`Apache2::Const::LOG_WARNING\*(C'\fI\fR.IX Subsection "Apache2::Const::LOG_WARNING".PP\fI\f(CI\*(C`Apache2::Const::LOG_NOTICE\*(C'\fI\fR.IX Subsection "Apache2::Const::LOG_NOTICE".PP\fI\f(CI\*(C`Apache2::Const::LOG_INFO\*(C'\fI\fR.IX Subsection "Apache2::Const::LOG_INFO".PP\fI\f(CI\*(C`Apache2::Const::LOG_DEBUG\*(C'\fI\fR.IX Subsection "Apache2::Const::LOG_DEBUG".Sh "Other Constants".IX Subsection "Other Constants"Make sure to compile the \s-1APR\s0 status constants before using them. Forexample to compile \f(CW\*(C`APR::Const::SUCCESS\*(C'\fR and all the \s-1APR\s0 error statusconstants do:.PP.Vb 1\&  use APR::Const    \-compile => qw(:error SUCCESS);.Ve.PPHere is the rest of the logging related constants:.PP\fI\f(CI\*(C`Apache2::Const::LOG_LEVELMASK\*(C'\fI\fR.IX Subsection "Apache2::Const::LOG_LEVELMASK".PPused to mask off the level value, to make sure that the log level'svalue is within the proper bits range. e.g.:.PP.Vb 1\&  $loglevel &= LOG_LEVELMASK;.Ve.PP\fI\f(CI\*(C`Apache2::Const::LOG_TOCLIENT\*(C'\fI\fR.IX Subsection "Apache2::Const::LOG_TOCLIENT".PPused to give content handlers the option of including the error textin the \f(CW\*(C`ErrorDocument\*(C'\fR sent back to the client. When\&\f(CW\*(C`Apache2::Const::LOG_TOCLIENT\*(C'\fR is passed to \f(CW\*(C`log_rerror()\*(C'\fR the error messagewill be saved in the \f(CW$r\fR's notes table, keyed to the string\&\fI\*(L"error-notes\*(R"\fR, if and only if the severity level of the message is\&\f(CW\*(C`Apache2::Const::LOG_WARNING\*(C'\fR or greater and there are no other\&\fI\*(L"error-notes\*(R"\fR entry already set in the request record's notestable. Once the \fI\*(L"error-notes\*(R"\fR entry is set, it is up to the errorhandler to determine whether this text should be sent back to theclient.  For example:.PP.Vb 6\&  use Apache2::Const \-compile => qw(:log);\&  use APR::Const    \-compile => qw(ENOTIME);\&  $r\->log_rerror(Apache2::Log::LOG_MARK,\&                 Apache2::Const::LOG_ERR|Apache2::Const::LOG_TOCLIENT,\&                 APR::Const::ENOTIME,\&                 "request log_rerror");.Ve.PPnow the log message can be retrieved via:.PP.Vb 1\&  $r\->notes\->get("error\-notes");.Ve.PPRemember that client-generated text streams sent back to the client\&\fB\s-1MUST\s0\fR be escaped to prevent \s-1CSS\s0 attacks..PP\fI\f(CI\*(C`Apache2::Const::LOG_STARTUP\*(C'\fI\fR.IX Subsection "Apache2::Const::LOG_STARTUP".PPis useful for startup message where no timestamps, logging level iswanted. For example:.PP.Vb 6\&  use Apache2::Const \-compile => qw(:log);\&  use APR::Const    \-compile => qw(SUCCESS);\&  $s\->log_serror(Apache2::Log::LOG_MARK,\&                 Apache2::Const::LOG_INFO,\&                 APR::Const::SUCCESS,\&                 "This log message comes with a header");.Ve.PPwill print:.PP.Vb 1\&  [Wed May 14 16:47:09 2003] [info] This log message comes with a header.Ve.PPwhereas, when \f(CW\*(C`Apache2::Const::LOG_STARTUP\*(C'\fR is binary ORed as in:.PP.Vb 6\&  use Apache2::Const \-compile => qw(:log);\&  use APR::Const    \-compile => qw(SUCCESS);\&  $s\->log_serror(Apache2::Log::LOG_MARK,\&                 Apache2::Const::LOG_INFO|Apache2::Const::LOG_STARTUP,\&                 APR::Const::SUCCESS,\&                 "This log message comes with no header");.Ve.PPthen the logging will be:.PP.Vb 1\&  This log message comes with no header.Ve.SH "Server Logging Methods".IX Header "Server Logging Methods".ie n .Sh """$s\->log""".el .Sh "\f(CW$s\->log\fP".IX Subsection "$s->log"get a log handle which can be used to log messages of differentlevels..PP.Vb 1\&  my $slog = $s\->log;.Ve.ie n .IP "obj: $s\fR ( \f(CW""Apache2::ServerRec object"" )" 4.el .IP "obj: \f(CW$s\fR ( \f(CWApache2::ServerRec object\fR )" 4.IX Item "obj: $s ( Apache2::ServerRec object )".PD 0.ie n .IP "ret: $slog\fR ( \f(CW""Apache2::Log::Server"" object )" 4.el .IP "ret: \f(CW$slog\fR ( \f(CWApache2::Log::Server\fR object )" 4.IX Item "ret: $slog ( Apache2::Log::Server object )".PD\&\f(CW\*(C`Apache2::Log::Server\*(C'\fR object to be used with LogLevelmethods..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """$s\->log_error""".el .Sh "\f(CW$s\->log_error\fP".IX Subsection "$s->log_error"just logs the supplied message to \fIerror_log\fR.PP.Vb 1\&  $s\->log_error(@message);.Ve.ie n .IP "obj: $s\fR ( \f(CW""Apache2::ServerRec object"" )" 4.el .IP "obj: \f(CW$s\fR ( \f(CWApache2::ServerRec object\fR )" 4.IX Item "obj: $s ( Apache2::ServerRec object )".PD 0.ie n .IP "arg1: @message ( strings \s-1ARRAY\s0 )" 4.el .IP "arg1: \f(CW@message\fR ( strings \s-1ARRAY\s0 )" 4.IX Item "arg1: @message ( strings ARRAY )".PDwhat to log.IP "ret: no return value" 4.IX Item "ret: no return value".PD 0.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPFor example:.PP.Vb 1\&  $s\->log_error("running low on memory");.Ve.ie n .Sh """$s\->log_serror""".el .Sh "\f(CW$s\->log_serror\fP".IX Subsection "$s->log_serror"This function provides a fine control of when the message is logged,gives an access to built-in status codes..PP.Vb 1\&  $s\->log_serror($file, $line, $level, $status, @message);.Ve.ie n .IP "obj: $s\fR ( \f(CW""Apache2::ServerRec object"" )" 4.el .IP "obj: \f(CW$s\fR ( \f(CWApache2::ServerRec object\fR )" 4.IX Item "obj: $s ( Apache2::ServerRec object )".PD 0.ie n .IP "arg1: $file ( string )" 4.el .IP "arg1: \f(CW$file\fR ( string )" 4.IX Item "arg1: $file ( string )".PDThe file in which this function is called.ie n .IP "arg2: $line ( number )" 4.el .IP "arg2: \f(CW$line\fR ( number )" 4.IX Item "arg2: $line ( number )"The line number on which this function is called.ie n .IP "arg3: $level\fR ( \f(CW""Apache2::LOG_* constant"" )" 4.el .IP "arg3: \f(CW$level\fR ( \f(CWApache2::LOG_* constant\fR )" 4.IX Item "arg3: $level ( Apache2::LOG_* constant )"The level of this error message.ie n .IP "arg4: $status\fR ( \f(CW""APR::Const status constant"" )" 4

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -