[tomcat] branch 8.5.x updated: Improve logging of security exception

2023-09-19 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 738b10302d Improve logging of security exception
738b10302d is described below

commit 738b10302de6fe4964ec9b23129e3b9a59d61a6a
Author: remm 
AuthorDate: Tue Sep 19 14:00:37 2023 +0200

Improve logging of security exception

The intent was to log more information if debug is enabled, not reduce
the log level.
Found by coverity.
---
 java/org/apache/tomcat/util/net/SSLUtilBase.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/SSLUtilBase.java 
b/java/org/apache/tomcat/util/net/SSLUtilBase.java
index e9d4726201..89dd4d9c9c 100644
--- a/java/org/apache/tomcat/util/net/SSLUtilBase.java
+++ b/java/org/apache/tomcat/util/net/SSLUtilBase.java
@@ -467,7 +467,7 @@ public abstract class SSLUtilBase implements SSLUtil {
 String msg = 
sm.getString("sslUtilBase.trustedCertNotValid", alias,
 ((X509Certificate) 
cert).getSubjectX500Principal(), e.getMessage());
 if (log.isDebugEnabled()) {
-log.debug(msg, e);
+log.warn(msg, e);
 } else {
 log.warn(msg);
 }


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Improve logging

2020-11-05 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 5dcce0e  Improve logging
5dcce0e is described below

commit 5dcce0e9ae51bcbb628f611349471aef4082f43b
Author: Mark Thomas 
AuthorDate: Thu Nov 5 11:15:05 2020 +

Improve logging
---
 test/org/apache/tomcat/websocket/TesterFirehoseServer.java | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/tomcat/websocket/TesterFirehoseServer.java 
b/test/org/apache/tomcat/websocket/TesterFirehoseServer.java
index eb8ed63..2c4d893 100644
--- a/test/org/apache/tomcat/websocket/TesterFirehoseServer.java
+++ b/test/org/apache/tomcat/websocket/TesterFirehoseServer.java
@@ -27,6 +27,8 @@ import javax.websocket.RemoteEndpoint.Basic;
 import javax.websocket.Session;
 import javax.websocket.server.ServerEndpoint;
 
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.websocket.server.TesterEndpointConfig;
 
 /**
@@ -136,6 +138,8 @@ public class TesterFirehoseServer {
 
 private static class Writer implements Runnable {
 
+private static final Log log = LogFactory.getLog(Writer.class);
+
 private final Session session;
 
 public Writer(Session session) {
@@ -147,7 +151,7 @@ public class TesterFirehoseServer {
 try {
 doRun();
 } catch (IOException ioe) {
-ioe.printStackTrace();
+log.error("Error on non-container thread", ioe);
 }
 }
 


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Improve logging

2020-11-05 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 5dcce0e  Improve logging
5dcce0e is described below

commit 5dcce0e9ae51bcbb628f611349471aef4082f43b
Author: Mark Thomas 
AuthorDate: Thu Nov 5 11:15:05 2020 +

Improve logging
---
 test/org/apache/tomcat/websocket/TesterFirehoseServer.java | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/tomcat/websocket/TesterFirehoseServer.java 
b/test/org/apache/tomcat/websocket/TesterFirehoseServer.java
index eb8ed63..2c4d893 100644
--- a/test/org/apache/tomcat/websocket/TesterFirehoseServer.java
+++ b/test/org/apache/tomcat/websocket/TesterFirehoseServer.java
@@ -27,6 +27,8 @@ import javax.websocket.RemoteEndpoint.Basic;
 import javax.websocket.Session;
 import javax.websocket.server.ServerEndpoint;
 
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.websocket.server.TesterEndpointConfig;
 
 /**
@@ -136,6 +138,8 @@ public class TesterFirehoseServer {
 
 private static class Writer implements Runnable {
 
+private static final Log log = LogFactory.getLog(Writer.class);
+
 private final Session session;
 
 public Writer(Session session) {
@@ -147,7 +151,7 @@ public class TesterFirehoseServer {
 try {
 doRun();
 } catch (IOException ioe) {
-ioe.printStackTrace();
+log.error("Error on non-container thread", ioe);
 }
 }
 


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Improve logging for failed WebSocket connections

2020-06-03 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 8e1ec7d  Improve logging for failed WebSocket connections
8e1ec7d is described below

commit 8e1ec7de65a32c140985b8d9fc0ee864f24d791b
Author: Mark Thomas 
AuthorDate: Wed Jun 3 08:55:54 2020 +0100

Improve logging for failed WebSocket connections

Primarily to help with debugging unit test failures.
---
 java/org/apache/tomcat/websocket/LocalStrings.properties   | 2 +-
 java/org/apache/tomcat/websocket/WsWebSocketContainer.java | 3 +--
 webapps/docs/changelog.xml | 4 
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties 
b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 744619a..9412ffe 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -128,7 +128,7 @@ wsWebSocketContainer.asynchronousSocketChannelFail=Unable 
to open a connection t
 wsWebSocketContainer.defaultConfiguratorFail=Failed to create the default 
configurator
 wsWebSocketContainer.endpointCreateFail=Failed to create a local endpoint of 
type [{0}]
 wsWebSocketContainer.failedAuthentication=Failed to handle HTTP response code 
[{0}]. Authentication header was not accepted by server.
-wsWebSocketContainer.httpRequestFailed=The HTTP request to initiate the 
WebSocket connection failed
+wsWebSocketContainer.httpRequestFailed=The HTTP request to initiate the 
WebSocket connection to [{0}] failed
 wsWebSocketContainer.invalidExtensionParameters=The server responded with 
extension parameters the client is unable to support
 wsWebSocketContainer.invalidHeader=Unable to parse HTTP header as no colon is 
present to delimit header name and header value in [{0}]. The header has been 
skipped.
 wsWebSocketContainer.invalidStatus=The HTTP response from the server [{0}] did 
not permit the HTTP upgrade to WebSocket
diff --git a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 
b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
index ce6ca57..67c507a 100644
--- a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
+++ b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
@@ -482,8 +482,7 @@ public class WsWebSocketContainer implements 
WebSocketContainer, BackgroundProce
 success = true;
 } catch (ExecutionException | InterruptedException | SSLException |
 EOFException | TimeoutException | URISyntaxException | 
AuthenticationException e) {
-throw new DeploymentException(
-sm.getString("wsWebSocketContainer.httpRequestFailed"), e);
+throw new 
DeploymentException(sm.getString("wsWebSocketContainer.httpRequestFailed", 
path), e);
 } finally {
 if (!success) {
 channel.close();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 47f56df..ba4662d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -102,6 +102,10 @@
 endpoint path is specified and catch invalid endpoint paths earlier.
 (markt)
   
+  
+Include the target URL in the log message when a WebSocket connection
+fails. (markt)
+  
 
   
   


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Improve logging when streams cannot be pruned.

2019-03-06 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new eed1f6a  Improve logging when streams cannot be pruned.
eed1f6a is described below

commit eed1f6a9f27f841bcb6eef8703e833d390b4d80b
Author: Mark Thomas 
AuthorDate: Wed Mar 6 18:13:12 2019 +

Improve logging when streams cannot be pruned.

This is to provide additional information to investigate reports like
https://bz.apache.org/bugzilla/show_bug.cgi?id=63223
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 6 +++---
 java/org/apache/coyote/http2/LocalStrings.properties  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 590f3b2..6f3287e 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -984,7 +984,7 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 sm.getString("upgradeHandler.stream.even", key), 
Http2Error.PROTOCOL_ERROR);
 }
 
-pruneClosedStreams();
+pruneClosedStreams(streamId);
 
 Stream result = new Stream(key, this);
 streams.put(key, result);
@@ -1018,7 +1018,7 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 }
 
 
-private void pruneClosedStreams() {
+private void pruneClosedStreams(int streamId) {
 // Only prune every 10 new streams
 if (newStreamsSinceLastPrune < 9) {
 // Not atomic. Increments may be lost. Not a problem.
@@ -1130,7 +1130,7 @@ public class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpU
 
 if (toClose > 0) {
 log.warn(sm.getString("upgradeHandler.pruneIncomplete", 
connectionId,
-Integer.toString(toClose)));
+Integer.toString(streamId), Integer.toString(toClose)));
 }
 }
 
diff --git a/java/org/apache/coyote/http2/LocalStrings.properties 
b/java/org/apache/coyote/http2/LocalStrings.properties
index f9ea1e3..c47e402 100644
--- a/java/org/apache/coyote/http2/LocalStrings.properties
+++ b/java/org/apache/coyote/http2/LocalStrings.properties
@@ -128,7 +128,7 @@ upgradeHandler.notifyAll=Connection [{0}], Stream [{1}], 
notifyAll() called to r
 upgradeHandler.pause.entry=Connection [{0}] Pausing
 upgradeHandler.prefaceReceived=Connection [{0}], Connection preface received 
from client
 upgradeHandler.pingFailed=Connection [{0}] Failed to send ping to client
-upgradeHandler.pruneIncomplete=Connection [{0}] Failed to fully prune the 
connection because streams were active / used in the priority tree. There are 
[{1}] too many streams
+upgradeHandler.pruneIncomplete=Connection [{0}], Stream [{1}], Failed to fully 
prune the connection because there are [{2}] too many active streams
 upgradeHandler.pruneStart=Connection [{0}] Starting pruning of old streams. 
Limit is [{1}] + 10% and there are currently [{2}] streams.
 upgradeHandler.pruned=Connection [{0}] Pruned completed stream [{1}]
 upgradeHandler.prunedPriority=Connection [{0}] Pruned unused stream [{1}] that 
may have been part of the priority tree


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org