Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XMLLayput and Log4J

Status
Not open for further replies.

kpiyush

MIS
Mar 25, 2004
1
US
Hi

I am planning to use MDC with Log4J and use it with the XMLLayout so that the MDC information (which in my case is the host name) is recorded with every log message .

I was able to successfully use MDC with the PatternLayout by specifying it as

<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%X{remotehost} %d{DATE} %-5p %-15c{1}: %m%n"/>
</layout>

However I am not able to do the same using XMLLayout . I browsed the net and could nt findy any examples as to doing something similar (i.e being able to use the equivalent of conversionpattern with XMLLayout ) .

Please help as our project deadline is coming closer and for last 5 days i have had no luck with the same . The Log4J docs also dont have any example as to how to format the XMLLayout output .

Any help would be cool !!

Thanks in advance

Kar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top