in reply to request logging with Mojolicious
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); }); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: request logging with Mojolicious
by tomgracey (Scribe) on Dec 15, 2022 at 17:34 UTC |