On 2 Jun 2015, at 9:31 pm, Matthew Mallard <matt@Q-Technologies.com.au> wrote:
Hi,
I’m trying to do some custom access logging in Dancer2. I note that plackup does the access logging (--access-log) and the man page for Plack::Middleware::AccessLog says that the format can be modified in the app.psgi file:
# in app.psgi use Plack::Builder; builder { enable "Plack::Middleware::AccessLog", format => "combined"; $app; };
I tried something similar in app.pl, but it kind of works, but doesn’t fully replace the existing access logging. That is: * the log file specified with --access-log remains unchanged - i.e. it keeps getting written to in ‘combined’ format * the new format specified gets written to STDERR (i.e. the location specified with --error-log (for plackup)
Here’s the config I’m using: use Plack::Builder; use mymod::api; builder { enable "AccessLog", format => '%h %l %u %t "%r" %>s %b "%{User-agent}i" "%{content-type}i'; mount '/api' => mymod::api->to_app; };
Any ideas on how I can get it to overwrite the default access logging?
Thanks, Matt
It would seem it’s a bug with Plack (https://github.com/plack/Plack/issues/436) with a work around.