mesos / chronos

Fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules
http://mesos.github.io/chronos/
Apache License 2.0
4.39k stars 528 forks source link

How can I set custom log4j properties? #852

Closed mindscratch closed 7 years ago

mindscratch commented 7 years ago

I'm using Marathon to run Chronos (specifically the Chronos docker image).

Following the recommendation on the debugging page, I added "-Dlog4j.configuration=file:///mnt/mesos/sandbox/log4j.properties" to the "args" section of the Marathon configuration.

When Chronos starts up it fails with:

[scallop] Error: Unknown option 'D'

How can I specify a custom log4j properties file?

mindscratch commented 7 years ago

It appears the docs are out of date, Chronos is using java.util.logging. A custom logging properties file can be set by setting the JVM_OPTS env variable. In the marathon json for running chronos, I added:

"env": {
   "JVM_OPTS": "-Djava.util.logging.config.file=/mnt/mesos/sandbox/logging.properties"
}
mindscratch commented 7 years ago

Actually, trying to provide a custom logging.properties doesn't seem to be working either.

mindscratch commented 7 years ago

Turns out, since chronos uses chaos, you have to configure logback (the logging library used by chaos).

I created a custom logback.xml file which I added to the fetch portion of my marathon app configuration. I then configured logback to use my file by adding this to my marathon json:

"env": {
   "JVM_OPTS": "-Dlogback.configurationFile=/mnt/mesos/sandbox/logback.xml"
}