Question

I am implementin log4j with struts2.

<param name="ConversionPattern" value="%d{dd-MMM-yyyy HH:mm:ss} %c{1} [%p] %m%n" />

and I am calling like from in my action.

logger.info("<p>SMS sent to XXXXXXXX </p>");

It's working fine. The result is

2013-11-18 10:09:23 SMSLogger [INFO] <p> SMS sent to XXXXXXXX</p>

But I want to write like below

<p>2013-11-18 10:09:23 SMSLogger [INFO] SMS sent to XXXXXXXX</p>

I want this to do some format in web design.

Is there a way by include this in the log4j ConversionPattern ? Suggestions are welcome.

Was it helpful?

Solution

If possible, i would suggest you to handle this html paragraph element through your front end (html/jsp). If not then you can try out the custom formatter from logger as mentioned in the below URLs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top