[ecobee] only log stack traces to openhab.log if debug is enabled (#9443)

Signed-off-by: Rob Nielsen <rob.nielsen@yahoo.com>
This commit is contained in:
robnielsen 2020-12-22 21:51:22 -06:00 committed by GitHub
parent 22ac639233
commit 809ee6ffdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -167,9 +167,18 @@ public class EcobeeApi implements AccessTokenRefreshListener {
accessTokenResponse = localAccessTokenResponse;
ecobeeAuth.doAuthorization();
} catch (OAuthException | IOException | RuntimeException e) {
logger.info("API: Got exception trying to get access token from OAuth service", e);
if (logger.isDebugEnabled()) {
logger.info("API: Got exception trying to get access token from OAuth service", e);
} else {
logger.info("API: Got {} trying to get access token from OAuth service: {}",
e.getClass().getSimpleName(), e.getMessage());
}
} catch (EcobeeAuthException e) {
logger.info("API: The Ecobee authorization process threw an exception", e);
if (logger.isDebugEnabled()) {
logger.info("API: The Ecobee authorization process threw an exception", e);
} else {
logger.info("API: The Ecobee authorization process threw an exception: {}", e.getMessage());
}
ecobeeAuth.setState(EcobeeAuthState.NEED_PIN);
} catch (OAuthResponseException e) {
handleOAuthException(e);