差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

Both sides previous revision 前次修改
下次修改
前次修改
java:log4j2:indicateconfigurationfile [2022/04/10 11:35]
tony
java:log4j2:indicateconfigurationfile [2023/06/25 09:48] (目前版本)
行 63: 行 63:
 根據[[https://​logging.apache.org/​log4j/​2.x/​manual/​configuration.html#​AutomaticConfiguration|link]]描述,設定檔的搜尋規則與順序如下:​ 根據[[https://​logging.apache.org/​log4j/​2.x/​manual/​configuration.html#​AutomaticConfiguration|link]]描述,設定檔的搜尋規則與順序如下:​
   - 找log4j2.configurationFile所設定的檔案位置。   - 找log4j2.configurationFile所設定的檔案位置。
-  - 找 +  - 找檔案名稱為log4j2-test.properties的設定檔。根據不同格式的支援,順序為YAML>​JSON>​XML>​properties。 
 +  - 找檔案名稱為log4j2.properties的設定檔。根據不同格式的支援,順序為YAML>​JSON>​XML>​properties。 
 +  - 如果都找不到就是看log4j的預設值了。目前是ERROR Level+Console。 
 +這也是為什麼如果test code和production code都有設定檔時會先找到test code部分的原因。
  
 ===== Reference ===== ===== Reference =====
-  * [[https://​logging.apache.org/​log4j/​2.x/​manual/​configuration.html#​Automatic%20Configuratio|官方網站檔案設定介紹]]+  * [[https://​logging.apache.org/​log4j/​2.x/​manual/​configuration.html#​AutomaticConfiguratio|官方網站檔案設定介紹]]
   * [[https://​stackoverflow.com/​questions/​7126709/​how-do-i-set-log4j-level-on-the-command-line|How do I set log4j level on the command line?]]   * [[https://​stackoverflow.com/​questions/​7126709/​how-do-i-set-log4j-level-on-the-command-line|How do I set log4j level on the command line?]]
 =====    ===== =====    =====