search

Home  >  Q&A  >  body text

java-ee - 在一个已经开发好的java系统中加入日志

如何在一个已经开发好的java系统中,为某个功能下的方法,添加用户操作日志呢?没有使用spring,也无法用过滤器,是一个类似C/S结构的系统。

如用户在操作某个功能时,需要在日志中输出 用户名 操作的方法名 操作时间 等

巴扎黑巴扎黑2864 days ago728

reply all(6)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 09:52:50

    You can wrap a layer of your own object outside the functional object in the developed system to implement the same interface as the functional object or directly inherit the functional object. That is, use the proxy mode and just add logs to the proxy object yourself.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 09:52:50

    1. Using JDK’s dynamic proxy

    2. Adopt CGLIB bytecode enhancement library

    reply
    0
  • ringa_lee

    ringa_lee2017-04-18 09:52:50

    No filters, but blockers

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:52:50

    It means directly adding the log printing function without modifying the source code

    reply
    0
  • 迷茫

    迷茫2017-04-18 09:52:50

    I have written a log that uses reflection to record information changes. It is very basic, but it needs to be embedded into the original code.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:52:50

    Use java reflection.

    reply
    0
  • Cancelreply