如何在 JBoss 上记录 IP 地址

发布于 2024-09-11 11:15:44 字数 111 浏览 3 评论 0原文

我想记录呼叫我的 WS 的客户端的 IP 地址。

我怎样才能在 JBoss 上做到这一点?

编辑:

如果可能的话,我想在 JBOSS 上使用 log4J 配置。

I want to log the IP address of the client who is calling my WS.

How can I do that on JBoss?

EDIT:

I would like to use log4J configuration on JBOSS if possible.

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

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

发布评论

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

评论(2

兮颜 2024-09-18 11:15:44

将以下内容附加到 log4j 配置 xml 中的转换模式参数。

%X{RemoteAddress}

在您的代码中,您可以按如下方式记录 IP 地址:

MDC.put("RemoteAddress", request.getRemoteAddr())

Append the following to your conversion pattern parameter in log4j configuration xml.

%X{RemoteAddress}

And in your code you can log the ip address as follows:

MDC.put("RemoteAddress", request.getRemoteAddr())
远昼 2024-09-18 11:15:44

如果您通过 EJB3 提供功能,请阅读本文

Read this, in case you are provind functionality via EJB3.

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