archiva-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <br...@apache.org>
Subject Re: svn commit: r673280 - in /archiva/trunk/archiva-modules: archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/audit/ archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ archiva-web/arch
Date Thu, 03 Jul 2008 02:06:49 GMT
Ah, good - thanks!

I'm not sure if there's a way to do an excludes in the audit log to  
not hit a certain appender?

- Brett

On 03/07/2008, at 11:58 AM, Maria Odea Ching wrote:

> The logs in audit.log were still getting duplicated into the rolling
> archiva.log, so I just set the appender for each of the logging  
> configs
> that should be sent to the rolling log. Is there a more appropriate  
> way that
> this should be configured? :)
>
> -Deng
>
> On Wed, Jul 2, 2008 at 4:28 PM, Brett Porter <brett@apache.org> wrote:
>
>> Sorry, I don't understand the logging config changes - what is in  
>> the root
>> context that you don't want to send to the rolling log?
>>
>> Thanks,
>> Brett
>>
>>
>> On 02/07/2008, at 3:01 PM, oching@apache.org wrote:
>>
>> Author: oching
>>> Date: Tue Jul  1 22:01:08 2008
>>> New Revision: 673280
>>>
>>> URL: http://svn.apache.org/viewvc?rev=673280&view=rev
>>> Log:
>>> [MRM-810]
>>> -implemented the Auditable for UploadAction
>>> -cleaned up the logging config
>>>
>>> Modified:
>>>
>>> archiva/trunk/archiva-modules/archiva-base/archiva-repository- 
>>> layer/src/main/java/org/apache/maven/archiva/repository/audit/ 
>>> AuditEvent.java
>>>
>>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/ 
>>> java/org/apache/maven/archiva/web/action/UploadAction.java
>>>
>>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/ 
>>> resources/log4j.xml
>>>
>>> Modified:
>>> archiva/trunk/archiva-modules/archiva-base/archiva-repository- 
>>> layer/src/main/java/org/apache/maven/archiva/repository/audit/ 
>>> AuditEvent.java
>>> URL:
>>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/audit/AuditEvent.java?rev=673280&r1=673279&r2=673280&view=diff
>>>
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> ---
>>> archiva/trunk/archiva-modules/archiva-base/archiva-repository- 
>>> layer/src/main/java/org/apache/maven/archiva/repository/audit/ 
>>> AuditEvent.java
>>> (original)
>>> +++
>>> archiva/trunk/archiva-modules/archiva-base/archiva-repository- 
>>> layer/src/main/java/org/apache/maven/archiva/repository/audit/ 
>>> AuditEvent.java
>>> Tue Jul  1 22:01:08 2008
>>> @@ -37,6 +37,8 @@
>>>
>>>   public static final String MODIFY_FILE = "Modify File";
>>>
>>> +    public static final String UPLOAD_FILE = "Uploaded File";
>>> +
>>>   private String repositoryId;
>>>
>>>   private String userId;
>>>
>>> Modified:
>>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/ 
>>> java/org/apache/maven/archiva/web/action/UploadAction.java
>>> URL:
>>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java?rev=673280&r1=673279&r2=673280&view=diff
>>>
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> ---
>>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/ 
>>> java/org/apache/maven/archiva/web/action/UploadAction.java
>>> (original)
>>> +++
>>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/ 
>>> java/org/apache/maven/archiva/web/action/UploadAction.java
>>> Tue Jul  1 22:01:08 2008
>>> @@ -42,6 +42,9 @@
>>> import org.apache.maven.archiva.repository.RepositoryException;
>>> import  
>>> org.apache.maven.archiva.repository.RepositoryNotFoundException;
>>> import
>>> org 
>>> .apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
>>> +import org.apache.maven.archiva.repository.audit.AuditEvent;
>>> +import org.apache.maven.archiva.repository.audit.AuditListener;
>>> +import org.apache.maven.archiva.repository.audit.Auditable;
>>> import org.apache.maven.archiva.repository.metadata.MetadataTools;
>>> import
>>> org 
>>> .apache 
>>> .maven.archiva.repository.metadata.RepositoryMetadataException;
>>> import
>>> org 
>>> .apache.maven.archiva.repository.metadata.RepositoryMetadataReader;
>>> @@ -55,6 +58,7 @@
>>> import org.apache.maven.archiva.security.ArchivaXworkUser;
>>> import org.codehaus.plexus.xwork.action.PlexusActionSupport;
>>>
>>> +import com.opensymphony.webwork.ServletActionContext;
>>> import com.opensymphony.xwork.ActionContext;
>>> import com.opensymphony.xwork.Preparable;
>>> import com.opensymphony.xwork.Validateable;
>>> @@ -69,7 +73,7 @@
>>> */
>>> public class UploadAction
>>>   extends PlexusActionSupport
>>> -    implements Validateable, Preparable
>>> +    implements Validateable, Preparable, Auditable
>>> {
>>>   /**
>>>     * @plexus.requirement
>>> @@ -161,6 +165,11 @@
>>>    */
>>>   private RepositoryContentFactory repositoryFactory;
>>>
>>> +    /**
>>> +     * @plexus.requirement
>>> role="org.apache.maven.archiva.repository.audit.AuditListener"
>>> +     */
>>> +    private List<AuditListener> auditListeners = new
>>> ArrayList<AuditListener>();
>>> +
>>>   private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[] {
>>> ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 };
>>>
>>>   private ProjectModelWriter pomWriter = new  
>>> ProjectModel400Writer();
>>> @@ -383,9 +392,8 @@
>>>
>>>           String msg = "Artifact \'" + groupId + ":" + artifactId  
>>> + ":" +
>>> version +
>>>               "\' was successfully deployed to repository \'" +
>>> repositoryId + "\'";
>>> -
>>> -            //TODO: MRM-810 (this writes to archiva.log, should be
>>> audit.log)
>>> -            getLogger().info( msg + " by " + getPrincipal() );
>>> +
>>> +            triggerAuditEvent( getPrincipal(), repositoryId,  
>>> groupId +
>>> ":" + artifactId + ":" + version, AuditEvent.UPLOAD_FILE );
>>>
>>>           addActionMessage( msg );
>>>
>>> @@ -536,4 +544,30 @@
>>>           addActionError( ae.getMessage() );
>>>       }
>>>   }
>>> +
>>> +    public void addAuditListener( AuditListener listener )
>>> +    {
>>> +        this.auditListeners.add( listener );
>>> +    }
>>> +
>>> +    public void clearAuditListeners()
>>> +    {
>>> +        this.auditListeners.clear();
>>> +    }
>>> +
>>> +    public void removeAuditListener( AuditListener listener )
>>> +    {
>>> +        this.auditListeners.remove( listener );
>>> +    }
>>> +
>>> +    private void triggerAuditEvent( String user, String  
>>> repositoryId,
>>> String resource, String action )
>>> +    {
>>> +        AuditEvent event = new AuditEvent( repositoryId, user,  
>>> resource,
>>> action );
>>> +        event.setRemoteIP(
>>> ServletActionContext.getRequest().getRemoteAddr() );
>>> +
>>> +        for ( AuditListener listener : auditListeners )
>>> +        {
>>> +            listener.auditEvent( event );
>>> +        }
>>> +    }
>>> }
>>>
>>> Modified:
>>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/ 
>>> resources/log4j.xml
>>> URL:
>>> http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/resources/log4j.xml?rev=673280&r1=673279&r2=673280&view=diff
>>>
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> ---
>>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/ 
>>> resources/log4j.xml
>>> (original)
>>> +++
>>> archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/ 
>>> resources/log4j.xml
>>> Tue Jul  1 22:01:08 2008
>>> @@ -22,16 +22,14 @@
>>> </appender>
>>>
>>> <!-- Help identify bugs during testing -->
>>> -  <logger name="org.apache.maven">
>>> -    <level value="info"/>
>>> -  </logger>
>>> -
>>> <logger name="org.apache.maven.archiva">
>>> -    <level value="info" />
>>> +    <level value="info"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="org.apache.maven.archiva.repository.scanner">
>>>   <level value="info" />
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="org.apache.archiva.AuditLog">
>>> @@ -41,72 +39,87 @@
>>>
>>> <logger name="org.codehaus.plexus.security">
>>>   <level value="info"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <!-- squelch noisy objects (for now) -->
>>> <logger name="org.apache.commons">
>>>   <level value="warn"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="net.sf.ehcache">
>>>   <level value="warn"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="org.codehaus.plexus.mailsender.MailSender">
>>>   <level value="info"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="org.codehaus.plexus.velocity">
>>>   <level value="error"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="org.quartz">
>>>   <level value="info"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="org.apache.jasper">
>>>   <level value="info"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="com.opensymphony.xwork">
>>>   <level value="info"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="com.opensymphony.webwork">
>>>   <level value="info"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="org.codehaus.plexus.PlexusContainer">
>>>   <level value="info"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="JPOX">
>>>   <level value="warn"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="JPOX.MetaData">
>>>   <level value="error"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="JPOX.RDBMS.SQL">
>>>   <level value="error"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="SQL">
>>>   <level value="error"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger name="freemarker">
>>>   <level value="warn"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <logger
>>> name 
>>> = 
>>> "org 
>>> .codehaus 
>>> .plexus.component.manager.ClassicSingletonComponentManager">
>>>   <level value="error"/>
>>> +    <appender-ref ref="rolling" />
>>> </logger>
>>>
>>> <root>
>>>   <priority value ="info" />
>>> -    <appender-ref ref="rolling" />
>>> </root>
>>>
>>> -</log4j:configuration>
>>> +</log4j:configuration>
>>> \ No newline at end of file
>>>
>>>
>>>
>> --
>> Brett Porter
>> brett@apache.org
>> http://blogs.exist.com/bporter/
>>
>>

--
Brett Porter
brett@apache.org
http://blogs.exist.com/bporter/


Mime
View raw message