Apache Log4j 2.11.2 釋出,流行的 Java 日誌元件
Apache Log4j 2.11.2 已釋出 ,可用於生產環境。Log4j 2.11.2 是 Log4j 的最新版本,包含在 Log4j 2.6 釋出後發現的幾個錯誤修復,可以在最新的變更日誌 中找到修復內容列表。
要注意的是,Log4j 2 的 API 與 Log4j 1.x 不相容,但是可以使用介面卡來讓應用程式繼續使用 Log4j 1.x API。介面卡也可用於 Apache Commons Logging, SLF4J 和 java.util.logging。
此外,在 Log4j 2.6 釋出之後,由於向 Logger 介面添加了新方法,因此與先前版本出現不相容問題。 如果你有以下程式碼:
logger.error(null, "This is the log message", throwable);
或類似於的任何日誌級別,將會收到編譯器錯誤,指出引用不明確。要糾正這個錯誤,要麼:
logger.error("This is the log message", throwable);
要麼
logger.error((Marker) null, "This is the log message", throwable);
Log4j 2.11.2 與之前的版本保持二進位制相容性,下載地址https://logging.apache.org/log4j/2.x/download.html 。
2.11.2 的詳細更新內容請檢視釋出說明 。