olegk wrote:
> 
> mikkin wrote:
>> Hi,
>> 
>> We have a multi-threaded application that makes simultaneous http GET &
>> POST
>> to the web-server. We use log4j to capture httpclient.wire traces and log
>> them in diiferent files (one file per thread). However, running in
>> multi-threaded mode, the httpclient.wire logs from one thread gets mixed
>> up
>> from other thread. We also have test logs that we use and they work
>> perfectly fine. Its just when we try to capture httpclient.wire logs, we
>> get
>> this error. I was not sure if this question would be apt for this forum
>> or
>> log4j forum, but since the tests logs are captured properly, I would
>> assume
>> it to be a httpclient.wire issue.
>> 
>> The way we instantiate the capturing of logs in the constructor:
>> 
>> LogManager.getLoggerRepository().getLogger("httpclient.wire").setLevel(Level.DEBUG);
>> 
>> Let me know if there is any more info that I can provide to help you in
>> helping me debugging this issue :)
>> 
>> -Mikkin
> 
> Mikkin,
> 
> You can configure log4j to include thread names in the log and then use 
> grep or similar tool to filter events by a thread name.
> 
> ---
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%5p [%t] %m%n
> ---
> 
> Hope this helps
> 
> Oleg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> For additional commands, e-mail: httpclient-users-h...@hc.apache.org
> 
> 
> 

Oleg,

Thanks for the reply.

Actually we would typically like each thread to have its wire trace recorded
into its own file. Let me explain with eg:

Thread 10 will capture wire trace of class A and store the wire trace in
File A
Thread 11 will capture wire trace of class B and store the wire trace in
File B.

Both Thread 10 and Thread 11 will be running simultaneously ofcourse. We
looked into the source code a while back and realized that Wire.java has a
static HEADER_WIRE and CONTENT_WIRE fields and a private constructor. So
could it be that when we do Logger.getLogger("httpclient.wire") in our
constructor both Thread 10 and Thread 11 in the above example are returned
with the same instance of the Wire log and thus causing the logs to get
mixed up?

Currently we run 30 such threads and the output files are a disaster :)

Also, just as an FYI, we are using httpclient 3.x. 

Mikkin
-- 
View this message in context: 
http://www.nabble.com/mix-logs-when-capturing-httpclient.wire-traces-in-multi-threaded-application-tp24397094p24400772.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to