• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Include session id in log file using log4j.xml

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using ConversionPattern to display date, time and sessionID in transaction logging file. Included the below statements in log4j.xml file.
<appender name="transaction" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="C://logs/abc.tran"/>
<param name="DatePattern" value="'.'yyyyMMdd"/>
<param name="Append" value="true"/>
<param name="ImmediateFlush" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyyMMdd HH:mm:ss,SSS} [%X{sessionID}] - %m%n"/>
</layout>
</appender>

After running the application I sometimes get empty sessionID in transaction log file. I included log.info statement in one of the java file to print the session id. Session id is neither null or empty. It shows valid session id but the same is not displayed in transaction log file sometimes.

Transaction log output:
20110520 15:11:02,209 [] - 3798 X220_GETUSERAUTH Class Details: " ReorderUtil class; getSerialNumber(String loginId, String serialNum, int callId) method."

Application log output:
20 May 2011 15:11:03,381 INFO [http-443-Processor22] modal.OrderServlet - sessionId--> 4186F233C819AE683E421F7483CD439A

Any idea how we can ensure session id is always displayed in transaction log file?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic