This is an automated email from the ASF dual-hosted git repository.

olamy pushed a commit to branch archiva-2.x
in repository https://gitbox.apache.org/repos/asf/archiva.git


The following commit(s) were added to refs/heads/archiva-2.x by this push:
     new 081c490d2 add a Delete action to delete logs older than 30D (#64)
081c490d2 is described below

commit 081c490d2c0f4fd28e76319302fb669e6b850ac8
Author: Olivier Lamy <[email protected]>
AuthorDate: Mon Apr 11 07:53:28 2022 +1000

    add a Delete action to delete logs older than 30D (#64)
    
    * delete old logs files
    * do not fork compilation
    
    Signed-off-by: Olivier Lamy <[email protected]>
---
 Jenkinsfile                                                |  2 +-
 .../archiva-webapp/src/main/resources/log4j2.xml           | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index b7fa99980..7d60a36af 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -72,7 +72,7 @@ pipeline {
                                 // -Dmaven.compiler.fork=false: Do not compile 
in a separate forked process
                                 // -Dmaven.test.failure.ignore=true: Do not 
stop, if some tests fail
                                 // -Pci-build: Profile for CI-Server
-                                sh "mvn clean install -B -U -e -fae -T2 
-Dmaven.compiler.fork=true -Pci-build"
+                                sh "mvn clean install -B -U -e -fae -T2 
-Pci-build"
                             }
                 }
             }
diff --git 
a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/log4j2.xml 
b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/log4j2.xml
index 462ebddfb..352183a2b 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/log4j2.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/log4j2.xml
@@ -36,6 +36,13 @@
       <Policies>
         <TimeBasedTriggeringPolicy />
       </Policies>
+      <DefaultRolloverStrategy max="30">
+        <Delete basePath="${logsDirectory}" maxDepth="2">
+          <IfFileName glob="*/*.log">
+            <IfLastModified age="P30D"/>
+          </IfFileName>
+        </Delete>
+      </DefaultRolloverStrategy>
     </RollingRandomAccessFile>
 
     <RollingRandomAccessFile name="auditlog" 
fileName="${logsDirectory}/archiva-audit.log"
@@ -47,6 +54,13 @@
       <Policies>
         <TimeBasedTriggeringPolicy />
       </Policies>
+      <DefaultRolloverStrategy max="30">
+        <Delete basePath="${logsDirectory}" maxDepth="2">
+          <IfFileName glob="*/*.log">
+            <IfLastModified age="P30D"/>
+          </IfFileName>
+        </Delete>
+      </DefaultRolloverStrategy>
     </RollingRandomAccessFile>
 
   </appenders>

Reply via email to