use Plack::Builder;
use Plack::Request;
use Digest::SHA qw/sha256/;
+use Log::Log4perl;
+
+use constant ACCESSLOG_FORMAT => '%{X-Forwarded-For}i|%h %u "%r" %>s %b "%{Referer}i" "%{User-agent}i"';
$Apache2::AuthzCaps::rootdir = $Apache2::Authen::Passphrase::rootdir;
my $word = qr,(\w+),a;
1
}
+Log::Log4perl->init('log.conf');
+my $access_logger = Log::Log4perl->get_logger('access');
+
builder {
+ enable 'AccessLog', format => ACCESSLOG_FORMAT, logger => sub { $access_logger->info(@_) };
enable 'ContentLength';
enable_if { $_[0]->{PATH_INFO} =~ qr,^/static/,} Header => set => ['Cache-Control', 'public, max-age=604800'];
enable 'Static', path => qr,^/static/,;
- enable 'Log4perl', category => 'plack', conf => 'log.conf';
+ enable 'Log4perl', category => 'plack';
enable \&require_admin;
enable_if \&some_auth_required, 'Auth::Basic', authenticator => \&authenticate, realm => 'Gruntmaster 6000';
Plack::App::Gruntmaster->to_app