Subject: | feature request: custom extra fields |
Date: | Fri, 6 Jun 2014 17:31:35 +0400 |
To: | bug-Log-Any-App [...] rt.cpan.org |
From: | Кирилл Матусов <freetransform [...] gmail.com> |
Hello,
I'd like to be able to pass arbitrary string as an extra field and access
it using pattern like "[requestid pid %P] [%d] %m%n".
Sometimes it's hard to locate desired log lines using only timestamps/pid
but it becomes simple once you've added some request id or similar field.
Moreover by passing this id value through different parts of distributed
system you can track the whole flow easily.
Using Log4perl it's possible via MDC feature by putting value
Log::Log4perl::MDC->put("request_id", $req->headers("X-Request-Id"));
and adding %X{request_id} to appender's ConversionPattern
--
Best regards,
Kirill