]> source.dussan.org Git - archiva.git/commitdiff
add proxy logging in debug mode
authorBrett Porter <brett@apache.org>
Wed, 30 Jul 2008 06:19:23 +0000 (06:19 +0000)
committerBrett Porter <brett@apache.org>
Wed, 30 Jul 2008 06:19:23 +0000 (06:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@680917 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java

index c3a9743b513e177b12807379ce0c71c9f48e3838..a5822b115b694bee67ae531cb7c76e1788213e2e 100644 (file)
@@ -980,32 +980,48 @@ public class DefaultRepositoryProxyConnectors
         {
             networkProxy = (ProxyInfo) this.networkProxyMap.get( connector.getProxyId() );
         }
-
-        try
-        {
-            AuthenticationInfo authInfo = null;
-            String username = remoteRepository.getRepository().getUsername();
-            String password = remoteRepository.getRepository().getPassword();
-
-            if ( StringUtils.isNotBlank( username ) && StringUtils.isNotBlank( password ) )
-            {
-                log.debug( "Using username " + username + " to connect to remote repository "
-                                       + remoteRepository.getURL() );
-                authInfo = new AuthenticationInfo();
-                authInfo.setUserName( username );
-                authInfo.setPassword( password );
-            }
-            else
+        
+        if ( log.isDebugEnabled() )
+        {            
+            if ( networkProxy != null )
             {
-                log.debug( "No authentication for remote repository needed" );
+                // TODO: move to proxyInfo.toString()
+                String msg =
+                    "Using network proxy " + networkProxy.getHost() + ":" + networkProxy.getPort()
+                        + " to connect to remote repository " + remoteRepository.getURL();
+                if ( networkProxy.getNonProxyHosts() != null )
+                {
+                    msg += "; excluding hosts: " + networkProxy.getNonProxyHosts();
+                }
+                if ( StringUtils.isNotBlank( networkProxy.getUserName() ) )
+                {
+                    msg += "; as user: " + networkProxy.getUserName();
+                }
+                log.debug( msg );
             }
+        }
 
-            //Convert seconds to milliseconds
-            int timeoutInMilliseconds = remoteRepository.getRepository().getTimeout() * 1000;
+        AuthenticationInfo authInfo = null;
+        String username = remoteRepository.getRepository().getUsername();
+        String password = remoteRepository.getRepository().getPassword();
 
-            //Set timeout
-            wagon.setTimeout(timeoutInMilliseconds);
+        if ( StringUtils.isNotBlank( username ) && StringUtils.isNotBlank( password ) )
+        {
+            log.debug( "Using username " + username + " to connect to remote repository "
+                + remoteRepository.getURL() );
+            authInfo = new AuthenticationInfo();
+            authInfo.setUserName( username );
+            authInfo.setPassword( password );
+        }
 
+        //Convert seconds to milliseconds
+        int timeoutInMilliseconds = remoteRepository.getRepository().getTimeout() * 1000;
+
+        //Set timeout
+        wagon.setTimeout(timeoutInMilliseconds);
+
+        try
+        {
             Repository wagonRepository = new Repository( remoteRepository.getId(), remoteRepository.getURL().toString() );
             wagon.connect( wagonRepository, authInfo, networkProxy );
             connected = true;