You could write your access logger like this:
sub startup {
# ...
my $r_begin = $self->routes;
my $r = $r_begin->under('' => sub {
my $c = shift;
my $params = $c->req->params->to_hash;
# do your logging here
});
#
# your endpoints here
#
# catch-all route at end, your fancy 404 page and also place for log
+ging
$r->any('/*whatever' => {whatever => ''} => sub {
my $c = shift;
my $message = 'PAGE 404 '.$c->tx->{original_remote_address}." ".$c
+->tx->req->url;
$self->app->log->debug($message); # . Dumper($c->tx)
$c->render(status => 404, text => $message);
});
}