Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log4j.properties updates from entrypoint.sh #12

Open
mcswaip1 opened this issue Oct 12, 2021 · 4 comments
Open

log4j.properties updates from entrypoint.sh #12

mcswaip1 opened this issue Oct 12, 2021 · 4 comments

Comments

@mcswaip1
Copy link

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.

@pladesma
Copy link
Collaborator

pladesma commented Oct 12, 2021

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_.

@cturczynskyj
Copy link
Collaborator

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

@psapozh
Copy link

psapozh commented Nov 1, 2021

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.

@psapozh
Copy link

psapozh commented Nov 1, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants