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

cannot set logging parameters #65

Open
chrisbitmead opened this issue Aug 17, 2023 · 1 comment
Open

cannot set logging parameters #65

chrisbitmead opened this issue Aug 17, 2023 · 1 comment
Labels
enhancement PR welcome If you know how to fix this, please submit a PR

Comments

@chrisbitmead
Copy link

I've been strugging in grails with the question of how to set an external logback.groovy location. I don't want to use -D on the command line because if you deploy in Tomcat that forces all apps to share the one config.

So I thought I'd found the solution in this external-config library. All I should have to do is set the location in an external config:

my-config.yml:

server.port: 8082
logging.config: logback.groovy
dataSource:
    url: jdbc:oracle:thin:@oracle-blah
    username: _user
    password: something

but it doesn't seem to get picked up. Note that I haven't set the parameter logging.config anywhere inside my app, or in application.yml . But I do have my application.yml set to pickup my-config.yml. I know this is working because it starts on 8082 and not the default 8080.

So if I run my app:

java -jar myapp.jar

and if logback.groovy doesn't exist, then it starts fine, no complaints. But if I do:
LOGGING_CONFIG=logback.groovy java -jar myapp.jar

It dies because logback.groovy doesn't exist.

Or in other words, setting logging.config using one of the normal grails mechanisms to some file that isn't there, crashes as expected. Setting it using this plugin does not.

Or in other words, this plugin is broken with regards to setting logging config.

I'm guessing this is because this plugin does whatever it does after logging has been initialized. But it really needs to do it earlier in the startup sequence. I think one of the spring callbacks should be able to do that, but I was hoping not to have to figure all that out by using this plugin.

@sbglasius
Copy link
Owner

@chrisbitmead The plugin is as such not broken, but does not work for your particular use case, and it has not been on my radar.
If you can come up with a solution, pull-requests are always welcomed

@sbglasius sbglasius added enhancement PR welcome If you know how to fix this, please submit a PR labels Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement PR welcome If you know how to fix this, please submit a PR
Projects
None yet
Development

No branches or pull requests

2 participants