为特定用户配置log4j

发布于 2024-11-02 10:15:00 字数 142 浏览 6 评论 0原文

您好,我在 J2EE 应用程序中使用 log4j,我有一个启用特定用户的日志详细信息并将其日志详细信息写入单独文件的场景。

有没有办法实现这个。

any help will be appreciated

Hi I am using log4j in my J2EE application, I have a scenario of enabling logging details of a particular user and write his log details in separate file.

Is there any way to implement this.

any help will be appreciated

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

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

发布评论

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

评论(1

耶耶耶 2024-11-09 10:15:00

方法是有的,但是不能通过配置来实现。

您需要编写自己的appender来扩展现有的Appender类(例如FileAppender或RollingFileAppender),并至少重写“public void activateOptions()”以根据当前用户设置文件。

There are ways, but you can't do it by configuration.

You need to write your own appender extending an existing Appender class (for example FileAppender or RollingFileAppender) and to override at least "public void activateOptions()" to set the file according to the current user.

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