GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PLACK::MIDDLEWARE::ACCESSLOG (3)

.ds Aq ’

NAME

Plack::Middleware::AccessLog - Logs requests like Apache’s log format

CONTENTS

SYNOPSIS



  # in app.psgi
  use Plack::Builder;

  builder {
      enable "Plack::Middleware::AccessLog", format => "combined";
      $app;
  };



DESCRIPTION

Plack::Middleware::AccessLog forwards the request to the given app and logs request and response details to the logger callback. The format can be specified using Apache-like format strings (or combined or common for the default formats). If none is specified combined is used.

This middleware uses calculable Content-Length by checking body type, and cannot log the time taken to serve requests. It also logs the request <B>beforeB> the response is actually sent to the client. Use Plack::Middleware::AccessLog::Timed if you want to log details <B>afterB> the response is transmitted (more like a real web server) to the client.

This middleware is enabled by default when you run plackup as a default development environment.

CONFIGURATION

format


  enable "Plack::Middleware::AccessLog",
      format => %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i";



Takes a format string (or a preset template combined or custom) to specify the log format. This middleware uses Apache::LogFormat::Compiler to generate access_log lines. See more details on perldoc Apache::LogFormat::Compiler



   %%    a percent sign
   %h    REMOTE_ADDR from the PSGI environment, or -
   %l    remote logname not implemented (currently always -)
   %u    REMOTE_USER from the PSGI environment, or -
   %t    [local timestamp, in default format]
   %r    REQUEST_METHOD, REQUEST_URI and SERVER_PROTOCOL from the PSGI environment
   %s    the HTTP status code of the response
   %b    content length of the response
   %T    custom field for handling times in subclasses
   %D    custom field for handling sub-second times in subclasses
   %v    SERVER_NAME from the PSGI environment, or -
   %V    HTTP_HOST or SERVER_NAME from the PSGI environment, or -
   %p    SERVER_PORT from the PSGI environment
   %P    the workers process id
   %m    REQUEST_METHOD from the PSGI environment
   %U    PATH_INFO from the PSGI environment
   %q    QUERY_STRING from the PSGI environment
   %H    SERVER_PROTOCOL from the PSGI environment



Some of these format fields are only supported by middleware that subclasses AccessLog.

In addition, custom values can be referenced, using %{name}, with one of the mandatory modifier flags i, o or t:



   %{variable-name}i    HTTP_VARIABLE_NAME value from the PSGI environment
   %{header-name}o      header-name header in the response
   %{time-format]t      localtime in the specified strftime format



logger


  my $logger = Log::Dispatch->new(...);
  enable "Plack::Middleware::AccessLog",
      logger => sub { $logger->log(level => debug, message => @_) };



Sets a callback to print log message to. It prints to the psgi.errors output stream by default.

AUTHORS

Tatsuhiko Miyagawa

Masahiro Nagano

SEE ALSO

Apache::LogFormat::Compiler, <http://httpd.apache.org/docs/2.2/mod/mod_log_config.html> Rack::CustomLogger
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 PLACK::MIDDLEWARE::ACCESSLOG (3) 2015-06-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.