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

Failures when starting war file is only visible in debug mode #174

Open
e-pettersson-ericsson opened this issue Oct 31, 2019 · 3 comments
Open
Labels
bug Something is wrong and needs fixing.

Comments

@e-pettersson-ericsson
Copy link
Member

Description

If I configure the publish service incorrectly and start the built war file locally with debug:false this property overwrites the other logging configurations so I'm not able to see why the service does not start properly. It just stops after logging some INFO about setting up rabbitmq ...

If I run with mvn spring-boot:run the error is logged properly (independent of other logging configurations) and I see the reason why the application does not start (configured wrong) but no message is visible when running the war file.

To reproduce:

  • Set debug:false in application.properties for publish
  • Configure RabbitMQ wrong (e.g. set wrong username/password)
  • Build the war file and run it using java -jar path/to/war/file command

Compare with running it with mvn spring-boot:run, where the application fails to start and maven tells why.

Motivation

When I run the war file with wrong configurations I shouldn't need to turn on debug:true to see why the application fails to start.

Exemplification

Benefits

Same behavior upon upstart for both mvn and java commands when starting application with debug:false.

Possible Drawbacks

@magnusbaeck
Copy link
Member

It sounds like you're hitting this (although it's not clear to me why this wouldn't affect executions via mvn spring-boot:run):

@PostConstruct
private void handleLogging() {
String debug = System.getProperty(PropertiesConfig.DEBUG);
log.setLevel(Level.ALL);
if (FALSE.equals(debug)) {
System.setProperty("logging.level.root", "OFF");
log.setLevel(Level.OFF);
}
}

I suggest we simply remove the debug property since its sole purpose seems to be to control the root logger's level in this all-or-nothing fashion. We can still set the root log level via properties. The code was added in #45 which contains no comments that would explain this weird piece of code.

@e-pettersson-ericsson
Copy link
Member Author

True, I don't see the need for this particular property at all, since it should be enough with the other logging configurations available in application.properties... Perhaps @xumakap can explain the reason why it was added? Don't know what kind of magic maven does in order to actually determine the build failure 😄

@Umadevi-Kapu
Copy link
Contributor

Actually we added handleLogging method for CLI not for service. If we enable -d option in CLI then using this method will display debug logs. but later versions of remrem-publish, someone changed it as @PostConstruct so it is changing service logger level too. so We need to change as handleLogging method is applicable to only CLI.

@e-pettersson-ericsson e-pettersson-ericsson added the bug Something is wrong and needs fixing. label Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong and needs fixing.
Projects
None yet
Development

No branches or pull requests

3 participants