【问题标题】:Is possible to load log4j2 config from config server?是否可以从配置服务器加载 log4j2 配置?
【发布时间】:2015-12-13 05:31:25
【问题描述】:

是否可以从配置服务器加载 log4j2 config.yml 或从配置服务器重新加载 spring boot 日志配置? 还是从 git 获取配置? 例如:

logging:
  config: http://xxx.xx.xx.xx:3000/admin123/config-repository/src/master/log4j2.yml

【问题讨论】:

    标签: java spring spring-boot yaml log4j2


    【解决方案1】:

    您必须以原始模式读取文件才能从 gogs 获取配置。 所以,你的网址是这样的:

    http://xxx.xx.xx.75:3000/admin123/config-repository/raw/master/log4j2.xml

    【讨论】:

      【解决方案2】:

      可以,通过使用系统属性 log4j.configurationFile 指定目标 URL。这接受任何格式正确的 URL。

      【讨论】:

      • 但是,在我的示例中是一个在 docker googs 容器中运行的 Git 存储库,如果只使用示例中的 URL,我会收到错误:[致命错误] log4j2.xml:37: 4: El tipo de elemento "link" debe finalizar por la etiqueta final 巧合 "".
      • 如果我输入:xxx.xxx.xx.75:3000/admin123/config-repository/raw/master/… 仅记录了一些以以下结尾的日志记录行:在任何属性源中找不到键“logging.config”。返回 [null]
      • @RemkoPopma 你有一个示例代码,可以根据环境从配置文件加载 log4j2.xml。我正在使用 cicd,我想为不同的环境加载 log4j2.xml 文件。我正在使用关键的云代工。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-03
      • 1970-01-01
      • 2016-09-20
      • 2015-07-13
      • 1970-01-01
      • 2015-06-06
      • 1970-01-01
      相关资源
      最近更新 更多