apache-kafka.service: pass in log4j config more explicitly

The implicit behavior of pulling it out of the classpath seemed not
to work properly and could be thrown off by other things on the
classpath also providing the properties file. This guarantees that
our settings stick.
This commit is contained in:
Dan Peebles 2017-02-27 18:32:09 +00:00
parent 7ef26640f6
commit 8def08a56c

View file

@ -19,13 +19,8 @@ let
${toString cfg.extraProperties}
'';
configDir = pkgs.buildEnv {
name = "apache-kafka-conf";
paths = [
(pkgs.writeTextDir "server.properties" serverProperties)
(pkgs.writeTextDir "log4j.properties" cfg.log4jProperties)
];
};
serverConfig = pkgs.writeText "server.properties" serverProperties;
logConfig = pkgs.writeText "log4j.properties" cfg.log4jProperties;
in {
@ -143,10 +138,11 @@ in {
serviceConfig = {
ExecStart = ''
${pkgs.jre}/bin/java \
-cp "${cfg.package}/libs/*:${configDir}" \
-cp "${cfg.package}/libs/*" \
-Dlog4j.configuration=file:${logConfig} \
${toString cfg.jvmOptions} \
kafka.Kafka \
${configDir}/server.properties
${serverConfig}
'';
User = "apache-kafka";
PermissionsStartOnly = true;