代码之家  ›  专栏  ›  技术社区  ›  Vineet Reynolds

选择正确版本的Apache Commons日志记录

  •  2
  • Vineet Reynolds  · 技术社区  · 15 年前

    我依赖于几个ApacheTLP(顶级项目),比如ApacheAxis、CommonsHTTPClient、CommonsDBCP、CommonsTransaction等。

    每个项目都依赖于JCL(Commons Logging),并且每个项目都依赖于不同版本的JCL。

    我应该选择哪个版本的JCL——最高版本是最佳选择吗?更高版本的JCL是否与针对较低版本编译的项目兼容(有些项目是针对JCL的1.0.x版本编译的,而其他项目是针对1.1.x版本编译的)?JCL项目本身是否在某个地方传递了这些信息?

    1 回复  |  直到 15 年前
        1
  •  2
  •   Mnementh    15 年前

    这个 RELEASE-NOTES 版本1.1.1的内容如下:

    == Incompatibilities ==
    
    The protected method LogFactory.getContextClassLoader has been reverted to pre-1.1
    behaviour. In earlier releases, this method did not use an AccessController when
    obtaining the context classloader. In version 1.1 it did. In this release, it has
    reverted to not using an AccessController; any user-level code that needs to obtain
    a context classloader should itself create an AccessController, and call the
    LogFactory.getContextClassLoader method via the doPrivileged method. This fixes a
    potential security issue, where untrusted code could get access to the context
    classloader if a signed Commons Logging library was in the classpath.
    

    这听起来很具体。我会尝试最新版本(1.1.1),看看是否出现了一些问题。