java-ee - 在一个已经开发好的java系统中加入日志
巴扎黑
巴扎黑 2017-04-18 09:50:50
0
6
708

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

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

巴扎黑
巴扎黑

reply all(6)
Ty80

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.

Ty80

1. Using JDK’s dynamic proxy

2. Adopt CGLIB bytecode enhancement library

左手右手慢动作

No filters, but blockers

巴扎黑

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

迷茫

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.

伊谢尔伦

Use java reflection.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template