LimpidLog 使用 java 的 java.lang.instrument.Instrumentation 来作为 Java 代理。 当你一个类注册日志服务时,LimpidLog 使用字节代码 sidenoting 把 日志信息添加到类代码中。 然后 LimpidLog 调用 Java JVM 和日志信息来重新构造类。JVM 会重新装载类,然后当类被实例化执行的时候 日志就开始工作了。 当你取消日志注册的时候 Limpidlog 会使用类原先的字节重新定义,这时类中的日志信息将会别去掉。
LimpidLog 是一个开源的日志工具包,发布协议遵守 an LGPL license , 地址: http://www.acelet.com/limpidlog/.
外国的程序员和国内的一样也很八卦,看看 tss 的回复吧:
I know what 'limpid' means, but a lot of people probably don't, and will read this name and go "LimpLog? hahaha!"
Just saying!
关于 LimpidLog 的工作细节可以参考下面:
The current implementation of Java requires to load javaagent at start time.
But, if you do not register any class, the price for the idle agent is:
1. Each time a class is loaded, a method will be called and returned quickly. Not much time wasted, because most of classes are loaded when the system starts. After that, loading will not happen very often.
2. LimpidLog keeps all loaded class names in memory. This piece of memory is relatively small compare to your program. The reason to keep this piece of memory is for performance.
3. The memory for LimpidLog itself is about 50K. Very small.
In later releases, I will make idle agent 100% idle. If you do not use it, JVM will not call it. Only the 50K memory will be "wasted". At the time you want log, you can activate it from the GUI manager.
第一次用我自己的 tss 翻译工具,很舒服,有时间会把本文完全翻译完............