Skip to content

Commit

Permalink
fixes igniterealtime#203: Reduce log level verbosity for some errors
Browse files Browse the repository at this point in the history
This should clean up logs from messages that can't be acted on by the user anyway.

Some logged events now have improved descriptions.
  • Loading branch information
guusdk committed Nov 17, 2024
1 parent ae85c60 commit 587835f
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ <h1>

<p><b>1.11.1</b> (tbd)</p>
<ul>
<li>[<a href='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/203'>#203</a>] - Reduce log level verbosity for some errors.</li>
<li>[<a href='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/200'>#200</a>] - Fix compatibility issue with Openfire 4.9.0.</li>
</ul>

Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<description>Allows administration over a RESTful API.</description>
<author>Roman Soldatow</author>
<version>${project.version}</version>
<date>2024-10-04</date>
<date>2024-11-17</date>
<minServerVersion>4.8.0</minServerVersion>
<adminconsole>
<tab id="tab-server">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private SessionEntities convertToSessionEntities(Collection<ClientSession> clien
session.setHostAddress(clientSession.getHostAddress());
session.setHostName(clientSession.getHostName());
} catch (UnknownHostException e) {
LOG.error("UnknownHostException", e);
LOG.debug("UnknownHostException", e);
}

session.setCreationDate(clientSession.getCreationDate());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 587835f

Please sign in to comment.