• <bdo id='crlv4'></bdo><ul id='crlv4'></ul>
      <tfoot id='crlv4'></tfoot>

      1. <legend id='crlv4'><style id='crlv4'><dir id='crlv4'><q id='crlv4'></q></dir></style></legend>

        <small id='crlv4'></small><noframes id='crlv4'>

        <i id='crlv4'><tr id='crlv4'><dt id='crlv4'><q id='crlv4'><span id='crlv4'><b id='crlv4'><form id='crlv4'><ins id='crlv4'></ins><ul id='crlv4'></ul><sub id='crlv4'></sub></form><legend id='crlv4'></legend><bdo id='crlv4'><pre id='crlv4'><center id='crlv4'></center></pre></bdo></b><th id='crlv4'></th></span></q></dt></tr></i><div id='crlv4'><tfoot id='crlv4'></tfoot><dl id='crlv4'><fieldset id='crlv4'></fieldset></dl></div>

        在 log4j xml 配置中使用系统环境变量

        Using system environment variables in log4j xml configuration(在 log4j xml 配置中使用系统环境变量)
          <tbody id='h1aYv'></tbody>

          <legend id='h1aYv'><style id='h1aYv'><dir id='h1aYv'><q id='h1aYv'></q></dir></style></legend>
          <tfoot id='h1aYv'></tfoot>

          <small id='h1aYv'></small><noframes id='h1aYv'>

            • <bdo id='h1aYv'></bdo><ul id='h1aYv'></ul>

              • <i id='h1aYv'><tr id='h1aYv'><dt id='h1aYv'><q id='h1aYv'><span id='h1aYv'><b id='h1aYv'><form id='h1aYv'><ins id='h1aYv'></ins><ul id='h1aYv'></ul><sub id='h1aYv'></sub></form><legend id='h1aYv'></legend><bdo id='h1aYv'><pre id='h1aYv'><center id='h1aYv'></center></pre></bdo></b><th id='h1aYv'></th></span></q></dt></tr></i><div id='h1aYv'><tfoot id='h1aYv'></tfoot><dl id='h1aYv'><fieldset id='h1aYv'></fieldset></dl></div>
                  本文介绍了在 log4j xml 配置中使用系统环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否可以在 log4j xml 配置文件中引用系统环境变量(相对于 Java 系统属性)?

                  Is it possible to reference system environment variables (as opposed to Java system properties) in a log4j xml configuration file?

                  我希望能够做类似的事情:

                  I'd like to be able to do something like:

                  <level value="${env.LOG_LEVEL}" />
                  

                  并让它从系统环境变量中获取,这样我就可以避免使用 -D 参数传递这么多东西.

                  and have it get that from the system environment variables, so I can avoid having to pass in so many things with -D parameters.

                  推荐答案

                  此语法仅记录在 log4j 2.X 中,因此请确保您使用的是正确的版本.它不适用于 1.X 版本.

                  This syntax is documented only in log4j 2.X so make sure you are using the correct version. It does not work on the 1.X versions.

                      <Appenders>
                      <File name="file" fileName="${env:LOG_PATH}">
                          <PatternLayout>
                              <Pattern>%d %p %c{1.} [%t] %m %ex%n</Pattern>
                          </PatternLayout>
                      </File>
                  </Appenders>
                  

                  这篇关于在 log4j xml 配置中使用系统环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                    <legend id='nJO3R'><style id='nJO3R'><dir id='nJO3R'><q id='nJO3R'></q></dir></style></legend>
                    • <small id='nJO3R'></small><noframes id='nJO3R'>

                        <tbody id='nJO3R'></tbody>
                      <tfoot id='nJO3R'></tfoot>

                        • <bdo id='nJO3R'></bdo><ul id='nJO3R'></ul>

                            <i id='nJO3R'><tr id='nJO3R'><dt id='nJO3R'><q id='nJO3R'><span id='nJO3R'><b id='nJO3R'><form id='nJO3R'><ins id='nJO3R'></ins><ul id='nJO3R'></ul><sub id='nJO3R'></sub></form><legend id='nJO3R'></legend><bdo id='nJO3R'><pre id='nJO3R'><center id='nJO3R'></center></pre></bdo></b><th id='nJO3R'></th></span></q></dt></tr></i><div id='nJO3R'><tfoot id='nJO3R'></tfoot><dl id='nJO3R'><fieldset id='nJO3R'></fieldset></dl></div>