Trying to log info from jsp file to console | Community
Skip to main content
Level 4
Feb 17, 2021 9:42 PM UTC
Solved

Trying to log info from jsp file to console

A little new to these jsp files .. I see a jsp file which has a variable .. I am trying to find out what the variable value is ,by logging it to the console .. Is there any easy way to. do this ..I tried exploring the options in here https://javabeat.net/how-to-debug-jsp/ But when i load the page which eventually calls this jsp ..its failing with 500 error. 

Caused by: org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP: 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SureshDhulipudi
SureshDhulipudiAccepted solution
New Participant
Feb 17, 2021 11:07 PM UTC

That might be syntax error

can you please provide the asp code here.

Look any jsp files in arm OOB for reference.

 

"text":"<%= jsp_variable%>"

2 replies

Anudeep_Garnepudi
New Participant
Feb 18, 2021 3:09 AM UTC

@aemnewbie 

You can do any of the following

  1. To print on page, use JSP expression <%= variableName %>
  2. To print in log file, use JSP scriptlet <% log.info(variableName) %>. Must include global.jsp and you can only print String values
  3. To print in server console, do System.out.println(variableName). Start instance using start.bat
Translate
SureshDhulipudi
SureshDhulipudiAccepted solution
New Participant
Feb 17, 2021 11:07 PM UTC

That might be syntax error

can you please provide the asp code here.

Look any jsp files in arm OOB for reference.

 

"text":"<%= jsp_variable%>"

Translate