为特定用户配置log4j
您好,我在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
方法是有的,但是不能通过配置来实现。
您需要编写自己的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.