Re: ThreadContext vs asynchronous app

2015-05-18 Thread Gary Gregory
Mikael,

Did you get any help on this?

Gary

On Fri, May 8, 2015 at 1:51 AM, Mikael Ståldal 
wrote:

> I have an asynchronous web app (in Scala based on Twitter Finagle, not
> using Servlet API).
>
> I use Log4j 2.2 for logging, and I want to tag log messages with some
> information about requests (such as client IP address and authenticated
> user ID).
>
> In a synchronous Servlet based web app, you can use Log4j's TheradContext
> for this, but it doesn't work in Finagle's asynchronous environment since
> there is no correlation between threads and requests.
>
> How can I do this?
>
> --
> [image: MagineTV]
>
>  *Mikael Ståldal*
> Senior backend developer
>
>  *Magine TV*
>  mikael.stal...@magine.com
>  Regeringsgatan 25  | 111 53 Stockholm, Sweden  |   www.magine.com
>
>  Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>



-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition

JUnit in Action, Second Edition 
Spring Batch in Action 
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


Re: JDK8 Problem

2015-05-18 Thread Gary Gregory
Does this work for you now? Is that why we have not hear back from you? ;-)

Gary

On Fri, May 8, 2015 at 7:25 PM, Gary Gregory  wrote:

> AFAIK it should work the same On java 7 and 8. You should publish your
> whole test including configuration so we can try to reproduce.
>
> Gary
>
>
>  Original message 
> From: Markward Schubert 
> Date: 05/08/2015 02:52 (GMT-08:00)
> To: log4j-user@logging.apache.org
> Subject: JDK8 Problem
>
> Dear Group,
>
> I have a problem with the JDK Loggin Adapter and JDK 8.0.45.
>
> In a tiny testprogram I open an HttpURLConnection and download a file.
> In order to do some testing, I managed to configure the Adapter as
> described here: http://logging.apache.org/log4j/2.x/log4j-jul/index.html
> and had a result as expecte.
>
> Specifically I pass the
> -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager word to
> the run command of the jar.
>
> The problem is, that this only worked with some older 7 JDK (7.0.40) I
> guess.
> When I then moved to a more recent JDK, the JRE Logging does not get
> through to my logfile.
> In the latter case only the logging from my own code appears in the file.
> Not the logging of HttpURLConnection.
>
> Is there some special precondition for using the JDK Logging Adapter with a
> JDK 8.x?
>
> Regards,
> Markward
>



-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition

JUnit in Action, Second Edition 
Spring Batch in Action 
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


Re: ThreadContext vs asynchronous app

2015-05-18 Thread Mikael Ståldal
No, not really.

There is some discussion on this JIRA issue, but it does not solve my
problem:
https://issues.apache.org/jira/browse/LOG4J2-1010

And even my suggestion in the JIRA issue is not ideal solution, just a
possible workaround.

What I really want is something which work like ThreadContext, and
implicitly put data into the context map of log messages, but which is not
tied to a JVM Thread.

(I am using Log4j 2.3 now, but that doesn't seem to make any difference for
this.)

On Mon, May 18, 2015 at 7:13 PM, Gary Gregory 
wrote:

> Mikael,
>
> Did you get any help on this?
>
> Gary
>
> On Fri, May 8, 2015 at 1:51 AM, Mikael Ståldal 
> wrote:
>
> > I have an asynchronous web app (in Scala based on Twitter Finagle, not
> > using Servlet API).
> >
> > I use Log4j 2.2 for logging, and I want to tag log messages with some
> > information about requests (such as client IP address and authenticated
> > user ID).
> >
> > In a synchronous Servlet based web app, you can use Log4j's TheradContext
> > for this, but it doesn't work in Finagle's asynchronous environment since
> > there is no correlation between threads and requests.
> >
> > How can I do this?
> >
> > --
> > [image: MagineTV]
> >
> >  *Mikael Ståldal*
> > Senior backend developer
> >
> >  *Magine TV*
> >  mikael.stal...@magine.com
> >  Regeringsgatan 25  | 111 53 Stockholm, Sweden  |   www.magine.com
> >
> >  Privileged and/or Confidential Information may be contained in this
> > message. If you are not the addressee indicated in this message
> > (or responsible for delivery of the message to such a person), you may
> not
> > copy or deliver this message to anyone. In such case,
> > you should destroy this message and kindly notify the sender by reply
> > email.
> >
>
>
>
> --
> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
> Java Persistence with Hibernate, Second Edition
> 
> JUnit in Action, Second Edition 
> Spring Batch in Action 
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
[image: MagineTV]

 *Mikael Ståldal*
Senior backend developer

 *Magine TV*
 mikael.stal...@magine.com
 Regeringsgatan 25  | 111 53 Stockholm, Sweden  |   www.magine.com

 Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.