Skip to content

Commit 9e898c2

Browse files
committed
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.
1 parent ae85c60 commit 9e898c2

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

changelog.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ <h1>
4646

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

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<description>Allows administration over a RESTful API.</description>
77
<author>Roman Soldatow</author>
88
<version>${project.version}</version>
9-
<date>2024-10-04</date>
9+
<date>2024-11-17</date>
1010
<minServerVersion>4.8.0</minServerVersion>
1111
<adminconsole>
1212
<tab id="tab-server">

src/java/org/jivesoftware/openfire/plugin/rest/AuthFilter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ public void filter(ContainerRequestContext containerRequest) throws IOException
129129
try {
130130
AuthFactory.authenticate(usernameAndPassword[0], usernameAndPassword[1]);
131131
} catch (UnauthorizedException e) {
132-
LOG.warn("Wrong HTTP Basic Auth authorization", e);
132+
LOG.info("Authentication for '{}' failed: incorrect credentials provided.", usernameAndPassword[0], e);
133133
throw new WebApplicationException(Status.UNAUTHORIZED);
134134
} catch (ConnectionException e) {
135-
LOG.error("Authentication went wrong", e);
135+
LOG.error("Authentication for '{}' failed: Openfire is not able to connect to the back-end users/group system.", usernameAndPassword[0], e);
136136
throw new WebApplicationException(Status.UNAUTHORIZED);
137137
} catch (InternalUnauthenticatedException e) {
138-
LOG.error("Authentication went wrong", e);
138+
LOG.error("Authentication for '{}' failed: Openfire is not able to authenticate itself to the back-end users/group system.", usernameAndPassword[0], e);
139139
throw new WebApplicationException(Status.UNAUTHORIZED);
140140
}
141141
} else {

src/java/org/jivesoftware/openfire/plugin/rest/controller/MsgArchiveController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public int getUnReadMessagesCount(JID jid) {
7878
messageCount = rs.getInt(1);
7979
}
8080
} catch (SQLException sqle) {
81-
LOG.error(sqle.getMessage(), sqle);
81+
LOG.warn("A database error prevented successful retrieval of the unread message count for user '{}' (the value '0' will be returned instead).", jid, sqle);
8282
} finally {
8383
DbConnectionManager.closeConnection(rs, pstmt, con);
8484
}

src/java/org/jivesoftware/openfire/plugin/rest/controller/SessionController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private SessionEntities convertToSessionEntities(Collection<ClientSession> clien
165165
session.setHostAddress(clientSession.getHostAddress());
166166
session.setHostName(clientSession.getHostName());
167167
} catch (UnknownHostException e) {
168-
LOG.error("UnknownHostException", e);
168+
LOG.debug("UnknownHostException", e);
169169
}
170170

171171
session.setCreationDate(clientSession.getCreationDate());

src/java/org/jivesoftware/openfire/plugin/rest/service/UserServiceLegacy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public Response userSerivceRequest() throws IOException {
187187
} catch (SharedGroupException e) {
188188
replyError("SharedGroupException", response, out);
189189
} catch (Exception e) {
190-
LOG.error("Error: ", e);
190+
LOG.error("Unexpected error while processing 'userservice' request of type '{}' for username '{}'", type, username, e);
191191
replyError(e.toString(), response, out);
192192
}
193193
return Response.status(200).build();

0 commit comments

Comments
 (0)