I have a servlet. But it is not working as desired. Hence for debugging purposes, I want to print statements to the java console(the one that can be opened using the java icon in taskbar). However, if I use System.out.println("message"), it doesnt display in java console.
Is there any alternative way where I can display messages to the console from the servlet? Or can anyone suggest me an alternative way to display messages to any other console?
In which console do you expect it to appear?
Depending on the servlet container (I assume Tomcat), the logs are stored in a logs
folder. For Tomcat this is tomcat/logs
(or more often referred to as CATALINA_HOME/logs
). If you are running it from within an IDE - they should be in the IDE console.
As a sidenote, using System.out
isn't advisable for a real product - use a logging framework (like log4j).