]> source.dussan.org Git - archiva.git/commitdiff
[MRM-187] improve proxy logging
authorBrett Porter <brett@apache.org>
Sat, 30 Sep 2006 12:42:11 +0000 (12:42 +0000)
committerBrett Porter <brett@apache.org>
Sat, 30 Sep 2006 12:42:11 +0000 (12:42 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@451590 13f79535-47bb-0310-9956-ffa450edef68

archiva-core/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyManager.java
archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyRequestHandler.java
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ProxyAction.java

index 9fc69353d5e3f16c38fed29508c010e2e360ea5a..fbd301829f57c94cea0b8da5841d438a1837ba55 100644 (file)
@@ -26,6 +26,7 @@ import org.apache.maven.archiva.configuration.RepositoryConfiguration;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.wagon.ResourceDoesNotExistException;
 import org.apache.maven.wagon.proxy.ProxyInfo;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
@@ -44,6 +45,7 @@ import java.util.Map;
  * @plexus.component instantiation-strategy="per-lookup"
  */
 public class DefaultProxyManager
+    extends AbstractLogEnabled
     implements ProxyManager
 {
     /**
@@ -95,7 +97,9 @@ public class DefaultProxyManager
         }
         else
         {
-            repositoryPath = repositoryPath.substring( proxyGroup.getManagedRepository().getId().length() + 2 );
+            String id = proxyGroup.getManagedRepository().getId();
+            getLogger().debug( "requesting " + repositoryPath + " from repository '" + id + "'" );
+            repositoryPath = repositoryPath.substring( id.length() + 2 );
         }
 
         return requestHandler.get( repositoryPath, proxyGroup.getProxiedRepositories(),
index 97eff1f8dc0f29c1f93835f12f5554c86b8a0fa7..0d19c301250f78149a7c36bb44d70f83e7ac6c3e 100644 (file)
@@ -143,15 +143,18 @@ public class DefaultProxyRequestHandler
                 artifactPath = path.substring( 0, index );
             }
 
+            String msg = "";
+
             // Request for artifact: parse the requested path to build an Artifact.
             Artifact artifact = null;
             try
             {
                 artifact = defaultArtifactDiscoverer.buildArtifact( artifactPath );
+                getLogger().debug( "Artifact requested is: " + artifact );
             }
             catch ( DiscovererException e )
             {
-                getLogger().debug( "Failed to build artifact using default layout with message: " + e.getMessage() );
+                msg = "Failed to build artifact from path:\n\tfrom default: " + e.getMessage();
             }
 
             if ( artifact == null )
@@ -159,10 +162,11 @@ public class DefaultProxyRequestHandler
                 try
                 {
                     artifact = legacyArtifactDiscoverer.buildArtifact( artifactPath );
+                    getLogger().debug( "Artifact requested is: " + artifact );
                 }
                 catch ( DiscovererException e )
                 {
-                    getLogger().debug( "Failed to build artifact using legacy layout with message: " + e.getMessage() );
+                    getLogger().debug( msg + "\n\tfrom legacy: " + e.getMessage() );
                 }
             }
 
@@ -500,15 +504,15 @@ public class DefaultProxyRequestHandler
                 {
                     tries++;
 
-                    getLogger().debug( "Trying " + path + " from " + repository.getName() + "..." );
-
                     boolean downloaded = true;
                     if ( force || !target.exists() )
                     {
+                        getLogger().debug( "Retrieving " + path + " from " + repository.getName() );
                         wagon.get( path, temp );
                     }
                     else
                     {
+                        getLogger().debug( "Retrieving " + path + " from " + repository.getName() + " if updated" );
                         downloaded = wagon.getIfNewer( path, temp, target.lastModified() );
                     }
 
@@ -537,6 +541,8 @@ public class DefaultProxyRequestHandler
                 {
                     moveTempToTarget( temp, target );
                 }
+
+                getLogger().debug( "Successfully downloaded" );
             }
             //try next repository
         }
index 5ae074d6d1b41c4dd941bd6f812f085ca08bac62..b75a2a97a1928c2d3fff76f183f16c26ab533950 100644 (file)
@@ -65,11 +65,13 @@ public class ProxyAction
         }
         catch ( ResourceDoesNotExistException e )
         {
+            getLogger().debug( "Requested proxy path not found: " + e.getMessage() );
             // TODO: set message?
             return NOT_FOUND;
         }
         catch ( FileNotFoundException e )
         {
+            getLogger().debug( "Requested proxy file not found: " + e.getMessage() );
             // TODO: set message?
             return NOT_FOUND;
         }