Closed donatomarro closed 7 years ago
hi @donatomarro
the restheart.jar file already contains the file logback.xml
, this is what is taken into account by logback (see more at logback configuration)
just replace this file with yours in the jar and it will work...
Ciao Andrea,
I would like to provide an external configuration file so that I can change the logging configuration while having restheart running.
The above link to the logback configuration page also mentions this option:
Specifying the location of the default configuration file as a system property
You may specify the location of the default configuration file with a system property named "logback.configurationFile".
You can see that this property is taken into account because the logback.xml that is packed within the jar doesn't have periodical scanning activated but mine has. And logback performs a rescan of my logback.xml because changes made to it are reflected by the logging output.
@donatomarro Do you feel you could open a pull request with the necessary modifications? At present we're overwhelmed with work and not sure when we'll be able to schedule this
@mkjsix I might let a colleague of mine have a look at it.
Hi,
it seems that the log level defined in the logback.xml is getting overridden by the log level defined in the restheart.yml on startup when starting Restheart using:
java -Dlogback.configurationFile=etc/logback.xml -server -jar restheart.jar etc/restheart.yml
I'm using the following setup: Restheart 3.0.1 / MongoDB 3.4.2 / Windows 10 64bit / Java 1.8.0_112
Log configuration within restheart.yml:
Content of logback.xml:
The logback.xml is definitely read by restheart on startup because the periodical scan is correctly activated. But logging is performed with the log level defined in the restheart.yml. Forcing a reload of the logback.xml by touching or editing it will then result into logging with the log level defined in the logback.xml.
My expectation is that the log level from the logback.xml should be used right away from the startup of Restheart.