1

I have a simple application with a simple logback.xml file, which I do not wish to put on the classpath. I can guarantee that it will be present where the application is run from, though.

I tried --logging.config=file:./logback.xml, but spring does not seem to honor the setting. What is the recommended way to achieve this? Thanks!

4
  • You can use resource plugin and keep it wherever you want. Commented Jul 20, 2016 at 22:11
  • Sprinboot made it very easy to write logs to external files. Just change the path from whitin the application.properties file. See my answer here stackoverflow.com/questions/38527175/… Commented Jul 26, 2016 at 9:15
  • @Georgesvanhoutte: I was trying to specify the location of the config file, not the output file. Commented Jul 27, 2016 at 11:49
  • Ok. Then you should override Spring Boot auto-configuration with explicit configuration like @PropertySource annotation; See doc : docs.spring.io/spring/docs/current/javadoc-api/org/… Commented Jul 27, 2016 at 12:41

1 Answer 1

1

It should be easy, as Logback has a feature for this purpose:

java -Dlogback.configurationFile=/path/to/config.xml ...

You can read more in the logback documentation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.