Print line number for log4j for JSP pages

I am using log4j to enter my Java project. My conversion scheme is as follows.

ConversionPattern=%d{MMMMM dd,yyyy HH:mm:ss} %-5p [ %C{1} - %M() - %L ] - %m%n 

Now for all Java classes, it outputs the result as follows:

 February 03,2012 15:18:41 DEBUG [ RadiusClientConfigBean - initialize() - 63 ] - RadiusClientsConfigBean.initialize() Called 

But for JSP pages, it prints like:

 February 03,2012 15:19:00 DEBUG [ managevoippolicy_jsp - _jspService() - 443 ] - VoIP Policies = 4 

which is not the actual line number of this JSP page. How to print line numbers for JSP pages.

+4
source share
2 answers

The way to determine the source line number from the JSP is to support JSR-45 debugging for other languages. The JSP compiler creates a SourceMap (SMAP) that you could use. (I would not recommend this for production).

As a starting point, this discussion may be useful:

http://tomcat.10.n6.nabble.com/Read-JSR-045-SMAP-Files-Produced-by-Jasper-td2128534.html

+1
source

Your JSP is recompiled as a servlet class, so you can never map them to the original page.

+2
source

Source: https://habr.com/ru/post/1394579/


All Articles