I have a simple servlet
that creates HTML with PrintWriter and writes to console via System.out.prinln()
in the same doGet() method.
You will find the System.out.println
outputs in your web container logs i.e in GalssFish logs.
Eclipse prints the sysout in its own console only for standalone applications and not for web applications. The reason is that, web applications are deployed in web containers and are run under those containers. Eclipse just helps that process of deploying the applicaitons but it does not deploy the webapps within it. Hence you will find the logs in the web container i.e glassfish.
How to Log out to console: Right click on your glassfish and go to View Log File Make sure the console setting is directed at your server.log file: