How to configure logging when running a JAR?

前端 未结 3 979
一整个雨季
一整个雨季 2021-02-14 14:15

I am new to Java logging API and need some help with this problem: While creating the application, my config file was stored in the project root folder, so I used -Djava.u

3条回答
  •  逝去的感伤
    2021-02-14 14:44

    You can't specify JVM arguments into the MANIFEST.MF file so you have to specify the logging properties at the command line or with a shortcut :

    java -Djava.util.logging.config.file=logging.properties -jar yourjar.jar
    

    Otherwise you could package a properties file(logging.properties in your case) in the JAR, read that at startup and put those settings into the system properties.

提交回复
热议问题