From 587835ff7f39798c82b2a7c8d9ab9bdf5b6b19ca Mon Sep 17 00:00:00 2001 From: Guus der Kinderen Date: Sun, 17 Nov 2024 19:55:34 +0100 Subject: [PATCH] fixes #203: Reduce log level verbosity for some errors This should clean up logs from messages that can't be acted on by the user anyway. Some logged events now have improved descriptions. --- changelog.html | 1 + plugin.xml | 2 +- .../org/jivesoftware/openfire/plugin/rest/AuthFilter.java | 6 +++--- .../plugin/rest/controller/MsgArchiveController.java | 2 +- .../openfire/plugin/rest/controller/SessionController.java | 2 +- .../openfire/plugin/rest/service/UserServiceLegacy.java | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/changelog.html b/changelog.html index 71050062f..422f099da 100644 --- a/changelog.html +++ b/changelog.html @@ -46,6 +46,7 @@

1.11.1 (tbd)

diff --git a/plugin.xml b/plugin.xml index 03d53aac9..cc2c7747f 100644 --- a/plugin.xml +++ b/plugin.xml @@ -6,7 +6,7 @@ Allows administration over a RESTful API. Roman Soldatow ${project.version} - 2024-10-04 + 2024-11-17 4.8.0 diff --git a/src/java/org/jivesoftware/openfire/plugin/rest/AuthFilter.java b/src/java/org/jivesoftware/openfire/plugin/rest/AuthFilter.java index ce447d5c4..7ab1111cf 100644 --- a/src/java/org/jivesoftware/openfire/plugin/rest/AuthFilter.java +++ b/src/java/org/jivesoftware/openfire/plugin/rest/AuthFilter.java @@ -129,13 +129,13 @@ public void filter(ContainerRequestContext containerRequest) throws IOException try { AuthFactory.authenticate(usernameAndPassword[0], usernameAndPassword[1]); } catch (UnauthorizedException e) { - LOG.warn("Wrong HTTP Basic Auth authorization", e); + LOG.info("Authentication for '{}' failed: incorrect credentials provided.", usernameAndPassword[0], e); throw new WebApplicationException(Status.UNAUTHORIZED); } catch (ConnectionException e) { - LOG.error("Authentication went wrong", e); + LOG.error("Authentication for '{}' failed: Openfire is not able to connect to the back-end users/group system.", usernameAndPassword[0], e); throw new WebApplicationException(Status.UNAUTHORIZED); } catch (InternalUnauthenticatedException e) { - LOG.error("Authentication went wrong", e); + LOG.error("Authentication for '{}' failed: Openfire is not able to authenticate itself to the back-end users/group system.", usernameAndPassword[0], e); throw new WebApplicationException(Status.UNAUTHORIZED); } } else { diff --git a/src/java/org/jivesoftware/openfire/plugin/rest/controller/MsgArchiveController.java b/src/java/org/jivesoftware/openfire/plugin/rest/controller/MsgArchiveController.java index 41536ee11..f87ad819c 100644 --- a/src/java/org/jivesoftware/openfire/plugin/rest/controller/MsgArchiveController.java +++ b/src/java/org/jivesoftware/openfire/plugin/rest/controller/MsgArchiveController.java @@ -78,7 +78,7 @@ public int getUnReadMessagesCount(JID jid) { messageCount = rs.getInt(1); } } catch (SQLException sqle) { - LOG.error(sqle.getMessage(), sqle); + LOG.warn("A database error prevented successful retrieval of the unread message count for user '{}' (the value '0' will be returned instead).", jid, sqle); } finally { DbConnectionManager.closeConnection(rs, pstmt, con); } diff --git a/src/java/org/jivesoftware/openfire/plugin/rest/controller/SessionController.java b/src/java/org/jivesoftware/openfire/plugin/rest/controller/SessionController.java index 5edd523da..1bd93bf6f 100644 --- a/src/java/org/jivesoftware/openfire/plugin/rest/controller/SessionController.java +++ b/src/java/org/jivesoftware/openfire/plugin/rest/controller/SessionController.java @@ -165,7 +165,7 @@ private SessionEntities convertToSessionEntities(Collection clien session.setHostAddress(clientSession.getHostAddress()); session.setHostName(clientSession.getHostName()); } catch (UnknownHostException e) { - LOG.error("UnknownHostException", e); + LOG.debug("UnknownHostException", e); } session.setCreationDate(clientSession.getCreationDate()); diff --git a/src/java/org/jivesoftware/openfire/plugin/rest/service/UserServiceLegacy.java b/src/java/org/jivesoftware/openfire/plugin/rest/service/UserServiceLegacy.java index 03dad0dc9..424daebc5 100644 --- a/src/java/org/jivesoftware/openfire/plugin/rest/service/UserServiceLegacy.java +++ b/src/java/org/jivesoftware/openfire/plugin/rest/service/UserServiceLegacy.java @@ -187,7 +187,7 @@ public Response userSerivceRequest() throws IOException { } catch (SharedGroupException e) { replyError("SharedGroupException", response, out); } catch (Exception e) { - LOG.error("Error: ", e); + LOG.error("Unexpected error while processing 'userservice' request of type '{}' for username '{}'", type, username, e); replyError(e.toString(), response, out); } return Response.status(200).build();