A different log for every user using Log4j

后端 未结 3 1127
轻奢々
轻奢々 2021-01-06 01:06

I have a webapplication and I want to use a different log for every user, so I can have a \"history\" of what the user did on the system.

This is what I have so far:

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-06 01:58

    Try switching to logback (log4j's successor). It comes with a SiftingAppender which can be used to separate (or sift) logging according to a given runtime attribute, which would be "userid" in your case. The documentation contains an example for separating logs based on userid.

提交回复
热议问题