I have developed a simple application such as insertion, updation in jsp,servlet that is java web. What i want to do is: suppose i am inserting data into my oracle db then data is inserted and i got a message that data has been inserted successfully, same thing i want to show in a command prompt when my web app is running in tomcat server. Application will run in browser and simultaneously command prompt will show that :
this data is inserted into this table---transaction committed successfully----
How can i implement that? Any help is much appreciated
The vast majority of Java web applications use Log4j for logging.
To log messages to the server’s console, use the Log4j ConsoleAppender class.
Normally you need to do little more than drop
log4j.jarinto yourtomcat/libdirectory, and configure logging with alog4j.xmlorlog4j.propertiesfile, then have your servlets or jsps or controllers or services issue logging commands. There are many tutorials on the web that can get you started learning log4j with tomcat.Oh and by the way, you can try plain old
System.out.println()calls from a servlet, though this is only for learning. Professional applications should use a logger.