eiffel-community / eiffel-remrem-publish

eiffel-remrem-publish
https://eiffel-community.github.io/eiffel-remrem-publish
Apache License 2.0
8 stars 77 forks source link

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

Open e-pettersson-ericsson opened 4 years ago

e-pettersson-ericsson commented 4 years ago

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:

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 commented 4 years ago

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):

https://github.com/eiffel-community/eiffel-remrem-publish/blob/268b75d31adc9e7acf8a5a7321b53e049109ac07/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/helper/RMQHelper.java#L112-L120

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 commented 4 years ago

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 commented 4 years ago

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.