logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mohan Kumar Pandian ( Tech - EA)" <mohan.pand...@flipkart.com>
Subject Re: Java Servlet request log using log4j2
Date Tue, 06 Sep 2016 10:30:15 GMT
As https://issues.apache.org/jira/browse/LOG4J2-1492 hasn't got enough
traction, we have implemented jetty's RequestLog using log4j2 for our use
case.

*MVN Dependency:*
<dependency>
    <groupId>com.flipkart.poseidon</groupId>
    <artifactId>log4j-access</artifactId>
    <version>5.0.0-SNAPSHOT</version>
</dependency>

*Sample code:*
RequestLogHandler requestLogHandler = new RequestLogHandler();
requestLogHandler.setRequestLog(new *Log4JAccessLog*
("<path_to_log4j_access_configuration_file>"));
requestLogHandler.setHandler(handler);

*PS:*
1. It is not officially released/supported. It was developed for our use
case under this License
<https://github.com/flipkart-incubator/Poseidon/blob/master/LICENSE> from
this open Source code
<https://github.com/flipkart-incubator/Poseidon/tree/master/log4j-access> and
library is available in Clojars
<https://clojars.org/com.flipkart.poseidon/log4j-access> repository. Once
LOG4J2-1492 gets closed officially, we'll stop supporting this library.

2. Sample config file
<https://github.com/flipkart-incubator/Poseidon/blob/master/log4j-access/src/test/resources/log4j-access.xml>
to
tune access log configuration (Ex: swapping status code and content length
can be achieved; size/time based log rotation can be achieved etc).

3. Library enables async access logging (Jetty's request and response
details are captured in a LogEvent synchronously but the event can be
asynchronously logged to file using async appended or
AsyncLoggerContextSelector etc). Basic converters to log remote host,
request line, status code, request headers are provided and can be extended
to include more features and web servers.

Regards,
Mohan.P

On Wed, Aug 3, 2016 at 12:51 PM, Mohan Kumar Pandian ( Tech - EA) <
mohan.pandian@flipkart.com> wrote:

> Thanks Matt, filed one - https://issues.apache.org/jira/browse/LOG4J2-1492
>
> Regards,
> Mohan.P
>
> On Sun, Jul 31, 2016 at 10:54 PM, Matt Sicker <boards@gmail.com> wrote:
>
>> You can add a feature request here:
>> https://issues.apache.org/jira/browse/LOG4J2
>>
>> Otherwise, the request kind of gets lost in the mailing list archives over
>> time.
>>
>> On 31 July 2016 at 12:21, Mohan Kumar Pandian ( Tech - EA) <
>> mohan.pandian@flipkart.com> wrote:
>>
>> > @Gary,
>> > Yes that would help.
>> >
>> > @Matt
>> > How can I add a jira issue? If there is no active feature request, I can
>> > raise one.
>> >
>> > Regards,
>> > Mohan.P
>> >
>> > On Sat, Jul 30, 2016 at 7:35 AM, Matt Sicker <boards@gmail.com> wrote:
>> >
>> > > I thought I made a feature request for this before, but I can't find
>> it.
>> > > Add a jira issue?
>> > >
>> > > On 29 July 2016 at 11:56, Gary Gregory <garydgregory@gmail.com>
>> wrote:
>> > >
>> > > > What a coincidence, I was just looking at that yesterday!
>> > > >
>> > > > Maybe this is something we can do for 2.7 in a log4j-jetty module,
>> I'm
>> > > not
>> > > > sure.
>> > > >
>> > > > Gary
>> > > >
>> > > > On Fri, Jul 29, 2016 at 5:01 AM, Mohan Kumar Pandian ( Tech - EA)
<
>> > > > mohan.pandian@flipkart.com> wrote:
>> > > >
>> > > > > Hi all,
>> > > > >
>> > > > > Logback provides logback-access.jar which brings in an
>> implementation
>> > > for
>> > > > > jetty's RequestLog that generates access logs using logback
>> > > > implementation.
>> > > > >
>> > > > > Is there a similar support in log4j2? I couldn't find any such
>> stuff
>> > in
>> > > > > log4j-web. If there is no out of box support for this on log4j2,
>> any
>> > > > > pointers on customizing and generating access log in servlet
>> > container
>> > > > > using log4j2 will help.
>> > > > >
>> > > > > Regards,
>> > > > > Mohan.P
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> > > > Java Persistence with Hibernate, Second Edition
>> > > > <http://www.manning.com/bauer3/>
>> > > > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> > > > Spring Batch in Action <http://www.manning.com/templier/>
>> > > > Blog: http://garygregory.wordpress.com
>> > > > Home: http://garygregory.com/
>> > > > Tweet! http://twitter.com/GaryGregory
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > Matt Sicker <boards@gmail.com>
>> > >
>> >
>>
>>
>>
>> --
>> Matt Sicker <boards@gmail.com>
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message