GWT 记录到文件

发布于 2025-01-04 18:33:44 字数 311 浏览 2 评论 0原文

我正在编写我的第一个 GWT,我承认我不知道如何设置记录器。

我正在将应用程序部署到 tomcat,并希望能够设置一个记录器,以便我可以记录到 $catalina.home 中的文件。 Gwt 附带了用于 java util 样式日志的logging.properties 和log4j.properties;我查看了 gwt java util 记录器的文档,它似乎只是写入控制台,所以它必须是我需要的 log4j?

过去我见过使用 org.apache.log4j.Logger,这是我想要的吗?

有人可以指出我记录此内容的地方吗?

谢谢。

I am writing my first GWT and i confess i have no idea how to set up loggers.

I am deploying the application to tomcat and want to be able to set up a logger so that i can log to a file in $catalina.home. Gwt came with logging.properties for a java util style log and log4j.properties; i have looked at documentation for the gwt java util logger and it seems to just write to console so it must be log4j i need?

In the past ive seen org.apache.log4j.Logger used, is this what i want?

Could somebody please point me to somewhere where this is documented?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初心未许 2025-01-11 18:33:44

文档位于此处。您不能直接使用文件附加程序,因为 GWT 代码在浏览器中作为 Javascript 运行(当不处于开发模式时)。如果您想记录到文件,则需要启用远程日志记录。

如果有服务器端部分日志记录工作正常。但它与 GWT 没有太大关系,除了在同一个项目中并提供服务(通过自定义协议)。

The documentation is here. You can't use file appenders directly because the GWT code runs as Javascript in the browser (when not in development mode). If you want to log to a file you need to enable remote logging.

If there is a server side part logging works as normal. But then it has not much to do with GWT, except for being in the same project and providing services (via a custom protocol).

榕城若虚 2025-01-11 18:33:44

您想记录什么? rpc 服务 servlet 还是客户端逻辑?

Log4j 仅适用于 java,不适用于 javascript。因此,它的目的是将您的类记录在将部署在您的服务器中的 /server/ 包中。

您的 /client/ 包类将被转换为 JavaScript 并在客户端浏览器中运行。所以,根本就没有Java!

您可以通过 http://code.google.com/p/ 使用 log4j“模拟”JavaScript gwt-log/ 它将使用 RemoteLogger 通过 rpc 将客户端日志发送到服务器,然后您可以将它们记录到文件中。

What do you want to log? rpc service servlets or client logic?

Log4j is just for java not javascript. So it is intended to log your classes in your /server/ package that will be deployed in your server.

Your /client/ package classes will be translated to javascript and will run in the client browser. So, no Java at all!

You can use log4j "emulated" to javascript with http://code.google.com/p/gwt-log/ which will send your client logs using a RemoteLogger to the server via rpc and then you can log them to a file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文