From 28c3b26be03e5ed02abd8eabc58485abe577df0d Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Wed, 30 Jul 2008 06:19:23 +0000 Subject: [PATCH] add proxy logging in debug mode git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@680917 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultRepositoryProxyConnectors.java | 58 ++++++++++++------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java index c3a9743b5..a5822b115 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java @@ -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; -- 2.39.5