Business Audit log - recommended library or approach? [closed]

[亡魂溺海] 提交于 2019-12-03 23:58:02

what about this https://github.com/dima767/inspektr I have almost the same requirements as you described above, and am digging into inspektr.

So, if you are looking for a framework, you could try logback-audit. It is by the folks who are behind the Java logging library, logback.

surajz

If you are using Java, one way is to use springframework and aop. This is the most flexible option. Here is an example

You can also do it at database level using hibernate (more info)

You can use AscpectJ library without Spring, via annotations

A good approach to business/operation level logging is to determine what exactly you need to log. You have already done that.

You don't really need any new framework or AOP to add. However, you have some extra requirements which prevent you from using the common logging frameworks such as Log4J or java.util.logging without creating more work.

The easiest approach I can think of you can do is to have a Audit class that has a JDBC connection injected or configured in it. This can be done through Spring if you are already using that framework. If you don't have a DI container then you need to define this as a singleton.

Another thing you need is a capability of signing. Java has a java.security.Signature to sign and verify data.

As I said earlier you have requirements that prevent you from using the available logging frameworks. That is:

  • search audit log based on metadata

For you to facilitate searching you need to store data in a database as writing to a text file will be difficult to do. Using the logging frameworks you have to learn the API and be tied to the framework which is not part of the standard.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!