Open mcswaip1 opened 3 years ago
No, currently, the log4j.properties can't be updated similarly to _MP_ variables. I like your idea to update entrypoint.sh to support modifying log4j.properties in a similar way to how we modify mirth.properties. We would definitely welcome any pull requests if you'd like to provide those changes. I'd recommend using _L4J_ as a prefix to those variables instead of _MP_.
I'm not sure if this would suffice, but you could do this using volumes, mapping an edited log4j.properties from the host to the container. Here's an example compose:
version: "3.1"
services:
mc:
image: nextgenhealthcare/connect
environment:
- VMOPTIONS=-Xmx512m
volumes:
- ./data/log4j.properties:/opt/connect/conf/log4j.properties
ports:
- 8080:8080/tcp
- 8443:8443/tcp
I would like to add that we are looking for this exact functionality. I think we are just looking for one env variable to set logging level. I tried doing this by overriding ENTRYPOINT
with my shell script and in my shell script calling entrypoint.sh
but this doesn't seem to work well. It fails on sed
which is weird because I haven't modified entrypoint.sh
.
The volume thing is definitely an option but its not as ideal as having env variable to set.
Maybe another way I am thinking of trying until this gets addressed is doing this in deploy script of some channel. I will let you know if I have any luck here.
Update have confirmed this works:
var envValue = java.lang.System.getenv('LOG_LEVEL');
var logLevel;
if (envValue == null || envValue.equals('INFO')) {
logLevel = Packages.org.apache.log4j.Level.INFO;
} else if (envValue.equals('ERROR')) {
logLevel = Packages.org.apache.log4j.Level.ERROR;
} else if (envValue.equals('DEBUG')) {
logLevel = Packages.org.apache.log4j.Level.DEBUG;
}
Packages.org.apache.log4j.Logger.getLogger('transformer').setLevel(logLevel);
Packages.org.apache.log4j.Logger.getLogger('preprocessor').setLevel(logLevel);
Packages.org.apache.log4j.Logger.getLogger('postprocessor').setLevel(logLevel);
Packages.org.apache.log4j.Logger.getLogger('deploy').setLevel(logLevel);
Packages.org.apache.log4j.Logger.getLogger('filter').setLevel(logLevel);
Packages.org.apache.log4j.Logger.getLogger('db-connector').setLevel(logLevel);
Packages.org.apache.log4j.Logger.getLogger('js-connector').setLevel(logLevel);
but would still like this issue to be addressed.
Can the log4j.properties values be updated in a similar way to the _MP__ variables? This would require an update to the entrypoint.sh file which would be better here than in a local repository. If I work on the changes and get them ready would that be acceptable? Thanks Paul.