Mantis - Quercus
Viewing Issue Advanced Details
2183 tweak always 11-17-07 02:42 11-19-07 22:18
koreth  
nam  
normal  
closed 3.1.4  
fixed  
none    
none 3.1.4  
0002183: Log spew when fsockopen() connection is refused
When fsockopen() is called and there's nothing listening on the remote port, a stack trace is output (if you have logging turned up to FINE level). The stack trace is really not useful since the error is exposed to the PHP code anyway, which presumably can do its own error handling. "Connection refused" is not necessarily even an error condition depending on the application.

My patch (and even this may be more logging than the condition really warrants):

--- a/modules/quercus/src/com/caucho/quercus/lib/NetworkModule.java
+++ b/modules/quercus/src/com/caucho/quercus/lib/NetworkModule.java
@@ -47,6 +47,7 @@ import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.InitialDirContext;
 import java.io.IOException;
+import java.net.ConnectException;
 import java.net.InetAddress;
 import java.net.Socket;
 import java.util.LinkedHashMap;
@@ -144,7 +145,10 @@ public class NetworkModule extends AbstractQuercusModule {
 
       return stream;
     } catch (IOException e) {
- log.log(Level.FINE, e.toString(), e);
+ if (e instanceof ConnectException)
+ log.log(Level.FINE, e.toString());
+ else
+ log.log(Level.FINE, e.toString(), e);
 
       if (errstr != null)
         errstr.set(env.createString(e.toString()));

Notes
(0002514)
nam   
11-19-07 22:18   
I think the stack trace may be useful => changed logging to FINER