This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Log4j - Could not get Thread number in log

 
vishnu deevi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I would be thankful if someone could tell How could I retrive the thread number in log file. How to configure log4j ? what pattern should be given for getting thread number ?

I have a sample configuration which gave the following log message in logs on different servers.

In Tomcat :

2003-10-19 20:38:34 HttpProcessor[8080][0] Starting background thread

In weblogic :

Jul 19 08:44:00 DEBUG [ExecuteThread-42]

In Sun One :

Aug 01 17:48:52 DEBUG [service-j2ee] ( I need to retrive thread number in SunOne ).

Thanks & Regards
Vishnu

SCJP, SCWCD
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you getting the output you displayed? Is it log4j output? If so, is the thread info from %t?

The PatternLayout API documentation says that %t in the conversion pattern results in printing the name of the thread.

If that is where your output is from it sounds like the "name" of the thread varies depending upon the server.
 
vishnu deevi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Carol

In the above log samples I have mentioned only for Sun One Its not giving the thread number. Will %t gives only the thread name ? How to retrive thread number also along with it.

Thanks for your help.

Regards
Vishnu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic