Plack::Middleware::AccessLog - Logs requests like Apache's log format
# in app.psgi use Plack::Builder; builder { enable "Plack::Middleware::AccessLog", format => "combined"; $app; };
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).
combined
common
This middleware uses calculable content-length by checking body type, and can not log the time taken to serve requests. It also logs the request before the response is actually sent to the client. Use Plack::Middleware::AccessLog::Timed if you want to log details after 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.
development
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 implements subset of Apache's LogFormat templates.
custom
my $logger = Log::Dispatch->new(...); enable "Plack::Middleware::AccessLog", logger => sub { $logger->log(debug => @_) };
Sets a callback to print log message to. It prints to psgi.errors output stream by default.
psgi.errors
http://httpd.apache.org/docs/2.2/mod/mod_log_config.html Rack::CustomLogger
To install Plack, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack
CPAN shell
perl -MCPAN -e shell install Plack
For more information on module installation, please visit the detailed CPAN module installation guide.