[英]show progress in command prompt when java web application is running
I have developed a simple application such as insertion, updation in jsp,servlet that is java web
. 我已经开发了一个简单的应用程序,例如
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
. 我想做的是:假设我正在将数据插入到
oracle db then data is inserted and i got a message that data has been inserted successfully
,当我的web app
在tomcat server
运行时,我想在command prompt
显示同样的内容tomcat server
。 Application will run in browser and simultaneously command prompt
will show that : 应用程序将在浏览器中运行,同时
command prompt
将显示:
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. 绝大多数Java Web应用程序使用Log4j进行日志记录。
To log messages to the server's console, use the Log4j ConsoleAppender class. 要将消息记录到服务器的控制台,请使用Log4j ConsoleAppender类。
Normally you need to do little more than drop log4j.jar
into your tomcat/lib
directory, and configure logging with a log4j.xml
or log4j.properties
file, then have your servlets or jsps or controllers or services issue logging commands. 通常,您要做的只是将
log4j.jar
放到tomcat/lib
目录中,并使用log4j.xml
或log4j.properties
文件配置日志记录,然后让Servlet或jsps或控制器或服务发出日志记录命令。 There are many tutorials on the web that can get you started learning log4j with tomcat. 网络上有很多教程,可以帮助您开始使用tomcat学习log4j。
Oh and by the way, you can try plain old System.out.println()
calls from a servlet, though this is only for learning. 哦,顺便说一句,您可以尝试从servlet进行简单的旧
System.out.println()
调用,尽管这只是为了学习。 Professional applications should use a logger. 专业应用程序应使用记录器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.