[MRM-1163] Add some decent logs in webdav for debugging purposes

Submitted by: Jevica Arianne Zurbano
o added debug logs in ArchivaDavResource and ArchivaDavResourceFactory with the filename, directory, repository, and/or current user included in logs


git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@798827 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maria Odea B. Ching 2009-07-29 09:55:18 +00:00
parent 57a95feef7
commit f62c635bde
3 changed files with 37 additions and 1 deletions

View File

@ -86,6 +86,15 @@
</logger>
-->
<!-- WebDav objects -->
<logger name="org.apache.maven.archiva.webdav.ArchivaDavResource">
<level value="info"/>
</logger>
<logger name="org.apache.maven.archiva.webdav.ArchivaDavResourceFactory">
<level value="info"/>
</logger>
<!-- squelch noisy objects (for now) -->
<logger name="org.apache.commons">
<level value="warn"/>

View File

@ -313,12 +313,16 @@ public class ArchivaDavResource
queueRepositoryTask( localFile );
log.debug( "File '" + resource.getDisplayName() + ( exists ? "' modified " : "' created ") + "(current user '" + this.principal + "')" );
triggerAuditEvent( resource, exists ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE );
}
else if ( !inputContext.hasStream() && isCollection() ) // New directory
{
localFile.mkdir();
log.debug( "Directory '" + resource.getDisplayName() + "' (current user '" + this.principal + "')" );
triggerAuditEvent( resource, AuditEvent.CREATE_DIR );
}
else
@ -343,10 +347,12 @@ public class ArchivaDavResource
DavResourceLocator resourceLocator =
locator.getFactory().createResourceLocator( locator.getPrefix(), path );
DavResource resource = factory.createResource( resourceLocator, session );
if ( resource != null )
{
list.add( resource );
}
log.debug( "Resource '" + item + "' retrieved by '" + this.principal + "'" );
}
}
catch ( DavException e )
@ -382,6 +388,7 @@ public class ArchivaDavResource
triggerAuditEvent( member, AuditEvent.REMOVE_FILE );
}
log.debug( ( resource.isDirectory() ? "Directory '" : "File '" ) + member.getDisplayName() + "' removed (current user '" + this.principal + "')" );
}
catch ( IOException e )
{
@ -425,6 +432,9 @@ public class ArchivaDavResource
triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.MOVE_FILE );
}
log.debug( ( isCollection() ? "Directory '" : "File '" ) + getLocalResource().getName() + "' moved to '" +
destination + "' (current user '" + this.principal + "')" );
}
catch ( IOException e )
{
@ -460,6 +470,8 @@ public class ArchivaDavResource
triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.COPY_FILE );
}
log.debug( ( isCollection() ? "Directory '" : "File '" ) + getLocalResource().getName() + "' copied to '" +
destination + "' (current user '" + this.principal + "')" );
}
catch ( IOException e )
{

View File

@ -191,6 +191,8 @@ public class ArchivaDavResourceFactory
"Write method not allowed for repository groups." );
}
log.debug( "Repository group '" + repoGroupConfig.getId() + "' accessed by '" + activePrincipal + "'" );
// handle browse requests for virtual repos
if ( RepositoryPathUtil.getLogicalResource( archivaLocator.getOrigResourcePath() ).endsWith( "/" ) )
{
@ -221,6 +223,8 @@ public class ArchivaDavResourceFactory
throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
}
log.debug( "Managed repository '" + managedRepository.getId() + "' accessed by '" + activePrincipal + "'" );
resource = processRepository( request, archivaLocator, activePrincipal, managedRepository );
String logicalResource = RepositoryPathUtil.getLogicalResource( locator.getResourcePath() );
@ -453,6 +457,10 @@ public class ArchivaDavResourceFactory
String event =
( previouslyExisted ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE )
+ PROXIED_SUFFIX;
log.debug( "Proxied artifact '" + resourceFile.getName() + "' in repository '" +
managedRepository.getId() + "' (current user '" + activePrincipal + "')" );
triggerAuditEvent( request.getRemoteAddr(), archivaLocator.getRepositoryId(),
logicalResource.getPath(), event, activePrincipal );
}
@ -481,6 +489,9 @@ public class ArchivaDavResourceFactory
{
destDir.mkdirs();
String relPath = PathUtil.getRelative( rootDirectory.getAbsolutePath(), destDir );
log.debug( "Creating destination directory '" + destDir.getName() + "' (current user '" + activePrincipal + "')" );
triggerAuditEvent( request.getRemoteAddr(), logicalResource.getPath(), relPath,
AuditEvent.CREATE_DIR, activePrincipal );
}
@ -555,6 +566,8 @@ public class ArchivaDavResourceFactory
resource.setPath( managedRepository.toPath( artifact ) );
log.debug( "Proxied artifact '" + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() + "'" );
return ( proxiedFile != null );
}
}
@ -852,6 +865,7 @@ public class ArchivaDavResourceFactory
if ( isAuthorized( request, repository ) )
{
mergedRepositoryContents.add( resourceFile );
log.debug( "Repository '" + repository + "' accessed by '" + activePrincipal + "'" );
}
}
catch ( DavException e )
@ -870,6 +884,7 @@ public class ArchivaDavResourceFactory
WebdavMethodUtil.getMethodPermission( request.getMethod() ) ) )
{
mergedRepositoryContents.add( resourceFile );
log.debug( "Repository '" + repository + "' accessed by '" + activePrincipal + "'" );
}
}
catch ( UnauthorizedException e )