English 中文(简体)
如何利用指挥线推翻退约变量
原标题:How to override logback default variable using command line

我在<代码>logback-sring.xml上有变数,我希望利用指挥线提供的价值,超越其违约价值。

<property name="log_root" value="${log.root:-logapp/logs}"/>
 <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log_root}/app.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log_root}/archived/app.%d{yyyy-MM-dd}.log</fileNamePattern>
            <!-- keep 30 days worth of history, but at most 1GB -->
            <totalSizeCap>1GB</totalSizeCap>
            <maxHistory>30</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>%level %d [%thread] %logger{15} - %msg %ex{2}%nopex%n</pattern>
        </encoder>
    </appender>

我试图在杰尔呼吁中推翻价值:

java -jar app.jar -Dlog.root=logappv2/logs

But the app always use the default log.root value. What is possibly the cause?

问题回答

这是你通过指挥线————————————————————传递的变量,但我看不到使用。

页: 1

java - Dlog.root=logappv2/logs -jar app.jar

Reference: Proper usage of Java -D command-line parameters





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签