I released Plack::Middleware::AxsLog version 0.10 at last week.
cpan: https://metacpan.org/release/Plack-Middleware-AxsLog
Plack-Middleware-AxsLog < 0.10 supports only combined, common, ltsv log format. And cannot specify the log format freely.
PM::AxsLog simply joined strings to generate logline. So it’s faster than PM::AccessLog. But does’t have ability to modify the log format.
By using Apache::LogFormat::Compiler, PM::AxsLog version 0.10 can modify log format without performance loss.
usage
use Plack::Builder;
builder {
enable 'AxsLog',
format => '%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i" %D',
response_time => 1,
error_only => 1,
$app
};
result of micro-benchmarking
Benchmark: running axslog, axslog_format, error_only_axslog, log, nolog for at least 3 CPU seconds...
axslog: 3 wallclock secs ( 3.15 usr + 0.01 sys = 3.16 CPU) @ 15955.70/s (n=50420)
axslog_format: 3 wallclock secs ( 3.19 usr + 0.01 sys = 3.20 CPU) @ 16036.25/s (n=51316)
error_only_axslog: 4 wallclock secs ( 3.14 usr + 0.01 sys = 3.15 CPU) @ 42440.32/s (n=133687)
log: 3 wallclock secs ( 3.18 usr + 0.01 sys = 3.19 CPU) @ 3216.61/s (n=10261)
nolog: 4 wallclock secs ( 3.13 usr + 0.00 sys = 3.13 CPU) @ 432826.20/s (n=1354746)
Rate log axslog axslog_format error_only_axslog nolog
log 3217/s -- -80% -80% -92% -99%
axslog 15956/s 396% -- -1% -62% -96%
axslog_format 16036/s 399% 1% -- -62% -96%
error_only_axslog 42440/s 1219% 166% 165% -- -90%
nolog 432826/s 13356% 2613% 2599% 920% --
benchmark script is here: https://github.com/kazeburo/Plack-Middleware-AxsLog/blob/master/logbench.pl