svn commit: r1346417 - in /cocoon/subprojects/cocoon-maven-plugin/trunk: ./ src/changes/ src/main/java/org/apache/cocoon/maven/rcl/ src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/ src/main/resources/org/apache/cocoon/maven/rcl/prof...

[email protected]
Newsgroups gmane.text.xml.cocoon.cvs
Message-ID <[email protected]>
Author: ilgrosso
Date: Tue Jun  5 15:16:51 2012
New Revision: 1346417

URL: http://svn.apache.org/viewvc?rev=1346417&view=rev
Log:
[COCOON-2322] Save plugin own dependencies to 'plugin-deps' during build and use it during prepare execution in order to enrich webapp classpath

Added:
    cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/classes/
    cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/classes/logback.xml   (with props)
Removed:
    cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/log4j.xml
Modified:
    cocoon/subprojects/cocoon-maven-plugin/trunk/pom.xml
    cocoon/subprojects/cocoon-maven-plugin/trunk/src/changes/changes.xml
    cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/java/org/apache/cocoon/maven/rcl/PrepareWebappMojo.java
    cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/applicationContext.xml

Modified: cocoon/subprojects/cocoon-maven-plugin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-maven-plugin/trunk/pom.xml?rev=1346417&r1=1346416&r2=1346417&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-maven-plugin/trunk/pom.xml (original)
+++ cocoon/subprojects/cocoon-maven-plugin/trunk/pom.xml Tue Jun  5 15:16:51 2012
@@ -50,6 +50,9 @@
   <properties>
     <docs.name>${project.name}</docs.name>
     <docs.version>${docs.m.maven-plugin.version}</docs.version>
+    
+    <slf4j.version>1.6.4</slf4j.version>
+    <logback.version>1.0.4</logback.version>
   </properties>
 
   <dependencies>
@@ -76,6 +79,51 @@
       <groupId>commons-lang</groupId>
       <artifactId>commons-lang</artifactId>
     </dependency>
+    
+    <!-- RCL -->
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-rcl-spring-reloader</artifactId>
+      <version>1.0.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-rcl-webapp-wrapper</artifactId>
+      <version>1.0.2-SNAPSHOT</version>
+    </dependency>
+      
+    <!-- Logging -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+      <version>${logback.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+      <version>${logback.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.1.1</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    
     <!-- Maven specific -->
     <dependency>
       <groupId>org.apache.maven</groupId>
@@ -122,8 +170,27 @@
   <build>
     <plugins>
       <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-plugin-plugin</artifactId>
       </plugin>
+      
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.4</version>
+        <executions>
+          <execution>
+            <id>save-plugin-dependency-list</id>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>list</goal>
+            </goals>
+            <configuration>
+              <outputFile>${project.build.directory}/classes/plugin-deps</outputFile>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 </project>

Modified: cocoon/subprojects/cocoon-maven-plugin/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-maven-plugin/trunk/src/changes/changes.xml?rev=1346417&r1=1346416&r2=1346417&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-maven-plugin/trunk/src/changes/changes.xml (original)
+++ cocoon/subprojects/cocoon-maven-plugin/trunk/src/changes/changes.xml Tue Jun  5 15:16:51 2012
@@ -23,6 +23,16 @@
   -->
 <document>
   <body>
+    <release version="1.0.2" date="2012-??-??" description="unreleased">
+      <action dev="ilgrosso" type="fix" issue="COCOON-2322">
+        Save plugin own dependencies to 'plugin-deps' during build and use it during prepare execution in order to
+        enrich webapp classpath.
+      </action>
+      <action dev="ilgrosso" type="add">
+        Switch the 'ssf' profile from log4j to logback to make it consistent with Cocoon 3.0.
+        'cocoon-22' was kept with log4j.
+      </action>
+    </release>
     <release version="1.0.0-M3" date="2008-??-??" description="unreleased">
       <action dev="reinhard" type="update">
         Upgrade to Spring-Framework 2.5.5

Modified: cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/java/org/apache/cocoon/maven/rcl/PrepareWebappMojo.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/java/org/apache/cocoon/maven/rcl/PrepareWebappMojo.java?rev=1346417&r1=1346416&r2=1346417&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/java/org/apache/cocoon/maven/rcl/PrepareWebappMojo.java (original)
+++ cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/java/org/apache/cocoon/maven/rcl/PrepareWebappMojo.java Tue Jun  5 15:16:51 2012
@@ -18,6 +18,7 @@ package org.apache.cocoon.maven.rcl;
 
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -26,11 +27,10 @@ import java.io.FileWriter;
 import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -38,11 +38,13 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
-
 import org.antlr.stringtemplate.StringTemplate;
 import org.apache.cocoon.maven.deployer.AbstractDeployMojo;
 import org.apache.cocoon.maven.deployer.WebXmlRewriter;
 import org.apache.cocoon.maven.deployer.utils.XMLUtils;
+import org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingListener;
+import org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingServlet;
+import org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingServletFilter;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
@@ -52,15 +54,11 @@ import org.apache.maven.artifact.factory
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
-import org.apache.maven.model.Dependency;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.artifact.InvalidDependencyVersionException;
-import org.apache.maven.project.artifact.MavenMetadataSource;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
@@ -75,16 +73,14 @@ import org.xml.sax.SAXException;
  */
 public class PrepareWebappMojo extends AbstractMojo {
 
-    private static final String LIB_VERSION_WRAPPER = "1.0.1-SNAPSHOT";
-
-    private static final String LIB_VERSION_SPRING_RELOADER = "1.0.1-SNAPSHOT";
-
     private static final String WEB_INF_WEB_XML = "WEB-INF/web.xml";
 
     private static final String WEB_INF_APP_CONTEXT = "WEB-INF/applicationContext.xml";
 
     private static final String WEB_INF_LOG4J = "WEB-INF/log4j.xml";
 
+    private static final String WEB_INF_CLASSES_LOGBACK = "WEB-INF/classes/logback.xml";
+
     private static final String WEB_INF_LIB = "WEB-INF/lib";
 
     private static final String WEB_INF_COCOON_SPRING_PROPS = "WEB-INF/cocoon/spring/rcl.properties";
@@ -98,6 +94,33 @@ public class PrepareWebappMojo extends A
     private static final String WEB_INF_RCLWRAPPER_PROPERTIES = "/WEB-INF/cocoon/rclwrapper.properties";
 
 
+    protected enum Profile {
+
+        COCOON22("cocoon-22"),
+        SSF("ssf");
+
+        private String name;
+
+        static Profile fromName(final String name) {
+            Profile result = null;
+            if (COCOON22.getName().equals(name)) {
+                result = COCOON22;
+            } else if (SSF.getName().equals(name)) {
+                result = SSF;
+            }
+
+            return result;
+        }
+
+        Profile(final String name) {
+            this.name = name;
+        }
+
+        public String getName() {
+            return name;
+        }
+    }
+    
     /**
      * The directory that contains the Cocoon web application.
      *
@@ -145,11 +168,11 @@ public class PrepareWebappMojo extends A
     private boolean reloadingClassLoaderEnabled = true;
 
     /**
-     * Logging: Use a custom log4j xml configuration file.
+     * Logging: Use a custom log4j (cocoon-22) / logback (ssf) xml configuration file.
      *
      * @parameter
      */
-    private String customLog4jXconf;
+    private String customLoggingConf;
 
     /**
      * Use a custom web application directory.
@@ -205,15 +228,6 @@ public class PrepareWebappMojo extends A
     private ArtifactRepository localRepository;
 
     /**
-     * Artifact resolver, needed to download source jars for inclusion in classpath.
-     *
-     * @component role="org.apache.maven.artifact.metadata.ArtifactMetadataSource"
-     * @required
-     * @readonly
-     */
-    private MavenMetadataSource metadataSource;
-
-    /**
      * The project whose project files to create.
      *
      * @parameter expression="${project}"
@@ -239,21 +253,28 @@ public class PrepareWebappMojo extends A
         }
 
         // check profile
-        if ("cocoon-22".equals(this.webappProfile)) {
-            this.getLog().info("Preparing a Cocoon web application.");
-        } else if ("ssf".equals(this.webappProfile)) {
-            this.getLog().info("Preparing a Servlet-Service web application.");
-        } else {
-            throw new MojoExecutionException("Only the profiles 'cocoon-22' and 'ssf' are supported.");
+        Profile activeProfile = Profile.fromName(this.webappProfile);
+        if (activeProfile == null) {
+            throw new MojoExecutionException("Only the profiles " + Profile.values() + " are supported.");
+        }
+        switch (activeProfile) {
+            case COCOON22:
+            default:
+                this.getLog().info("Preparing a Cocoon web application.");
+                break;
+
+            case SSF:
+                this.getLog().info("Preparing a Servlet-Service web application.");
+                break;
         }
 
-        // create web application containing all necessary files (web.xml, applicationContext.xml, log4j.xconf)
+        // create web application containing necessary files (web.xml, applicationContext.xml, log4j.xml / logback.xml)
         File webAppBaseDir = new File(this.target, "webapp");
         this.writeInputStreamToFile(this.readResourceFromClassloader(WEB_INF_WEB_XML),
                 createPath(new File(webAppBaseDir, WEB_INF_WEB_XML)));
         this.writeInputStreamToFile(this.readResourceFromClassloader(WEB_INF_APP_CONTEXT),
                 createPath(new File(webAppBaseDir, WEB_INF_APP_CONTEXT)));
-        this.writeLog4jXml(webAppBaseDir);
+        this.writeLoggingConf(activeProfile, webAppBaseDir);
 
         // copy the content of a custom webapp context directory to the prepared web application.
         this.copyCustomWebappDirectory(webAppBaseDir);
@@ -334,15 +355,14 @@ public class PrepareWebappMojo extends A
     }
 
     protected void copyRclWrapperLibs(File webAppBaseDir) throws MojoExecutionException {
-        Set rclWebappDependencies = this.getDependencies("org.apache.cocoon", "cocoon-rcl-webapp-wrapper", LIB_VERSION_WRAPPER, "jar");
-        for (Iterator rclIt = rclWebappDependencies.iterator(); rclIt.hasNext();) {
-            Artifact artifact = (Artifact) rclIt.next();
+        for (Artifact artifact: this.getDependencies()) {
             try {
                 FileUtils.copyFileToDirectory(artifact.getFile(), createPath(new File(webAppBaseDir, WEB_INF_LIB)));
             } catch (IOException e) {
-                throw new MojoExecutionException("Can't copy artifact " + artifact);
+                throw new MojoExecutionException("Can't copy artifact " + artifact, e);
             }
-            this.getLog().info("Adding lib to " + WEB_INF_LIB + ": " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":"
+            this.getLog().info("Adding lib to " + WEB_INF_LIB + ": "
+                    + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":"
                     + artifact.getVersion() + ":" + artifact.getType());
         }
     }
@@ -457,11 +477,6 @@ public class PrepareWebappMojo extends A
                 filteredArtifacts.add(eachArtifact);
             }
 
-            // add the Spring reloader libraries
-            Set<Artifact> springReloaderArtifacts = this.getDependencies("org.apache.cocoon", "cocoon-rcl-spring-reloader",
-                    LIB_VERSION_SPRING_RELOADER, "jar");
-            filteredArtifacts.addAll(springReloaderArtifacts);
-
             for (Artifact eachArtifact : filteredArtifacts) {
                 fw.write(eachArtifact.getFile().toURI().toURL().toExternalForm() + "\n");
                 this.getLog().debug("Adding library (URLClassLoader configuration): " + eachArtifact.getArtifactId());
@@ -472,44 +487,51 @@ public class PrepareWebappMojo extends A
             throw new MojoExecutionException("Error while writing to " + urlClConfFile, e);
         }
     }
-
-    protected Set<Artifact> getDependencies(final String groupId, final String artifactId, final String version,
-            final String packaging) throws MojoExecutionException {
-        Set returnSet = new HashSet();
-        try {
-            Set artifacts = null;
-            ArtifactResolutionResult result = null;
-
-            Dependency dependency = new Dependency();
-            dependency.setGroupId(groupId);
-            dependency.setArtifactId(artifactId);
-            dependency.setVersion(version);
-
-            List dependencies = new ArrayList();
-            dependencies.add(dependency);
-            Artifact pomArtifact = this.artifactFactory.createBuildArtifact("unspecified", "unspecified", "0.0", "jar");
-            Map managedDependencies = Collections.EMPTY_MAP;
-            artifacts = MavenMetadataSource.createArtifacts(this.artifactFactory, dependencies, "compile", null, null);
-            result = this.artifactResolver.resolveTransitively(artifacts, pomArtifact, managedDependencies, this.localRepository,
-                    this.remoteArtifactRepositories, this.metadataSource);
-
-            for (Iterator i = artifacts.iterator(); i.hasNext();) {
-                Artifact artifact = (Artifact) i.next();
-                returnSet.add(artifact);
-            }
-            for (Iterator i = result.getArtifacts().iterator(); i.hasNext();) {
-                Artifact artifact = (Artifact) i.next();
-                returnSet.add(artifact);
-            }
-        } catch (ArtifactResolutionException e) {
-            throw new MojoExecutionException("Can't resolve artifact " + groupId + ":" + artifactId + ":" + version, e);
-        } catch (ArtifactNotFoundException e) {
-            throw new MojoExecutionException("Can't find artifact " + groupId + ":" + artifactId + ":" + version, e);
-        } catch (InvalidDependencyVersionException e) {
-            throw new MojoExecutionException("Invalid version of artifact " + groupId + ":" + artifactId + ":"
-                    + version, e);
+        
+    protected Set<Artifact> getDependencies() {
+        Set<Artifact> result = new HashSet<Artifact>();
+
+        InputStream pluginDepsIS = getClass().getResourceAsStream("/plugin-deps");
+        if (pluginDepsIS == null) {
+            this.getLog().error("Could not find cocoon-maven-plugin dependencies descriptor");
+        } else {
+            BufferedReader pluginDepsReader = new BufferedReader(new InputStreamReader(pluginDepsIS));
+            String line;
+            try {
+                while ((line = pluginDepsReader.readLine()) != null) {
+                    line = line.trim();
+                    if (line.length() != 0) {
+                        String[] splitted = line.split(":");
+                        if (splitted.length == 5) {
+                            Artifact artifact = this.artifactFactory.createArtifact(
+                                    splitted[0], splitted[1], splitted[3], splitted[4], splitted[2]);
+
+                            try {
+                                this.artifactResolver.resolve(
+                                        artifact, this.remoteArtifactRepositories, this.localRepository);
+                                result.add(artifact);
+                            } catch (ArtifactNotFoundException e) {
+                                this.getLog().error("Could not find artifact", e);
+                            } catch (ArtifactResolutionException e) {
+                                this.getLog().error("Could not resolve artifact", e);
+                            }
+                        } else {
+                            this.getLog().debug("Unexpected input: ignoring - '" + line + "'");
+                        }
+                    }
+                }
+            } catch (IOException e) {
+                this.getLog().error("While reading cocoon-maven-plugin dependencies descriptor", e);
+            } finally {
+                try {
+                    pluginDepsReader.close();
+                } catch (IOException closeEx) {
+                    this.getLog().error("While closing cocoon-maven-plugin dependencies descriptor", closeEx);
+                }
+            }
         }
-        return returnSet;
+
+        return result;
     }
 
     protected RwmProperties readProperties() throws MojoExecutionException {
@@ -542,9 +564,9 @@ public class PrepareWebappMojo extends A
             throw new MojoExecutionException("Problem while parsing " + webXml);
         }
         WebXmlRewriter webXmlRewriter = new WebXmlRewriter(
-                "org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingServlet",
-                "org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingListener",
-                "org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingServletFilter", false);
+                ReloadingServlet.class.getName(),
+                ReloadingListener.class.getName(),
+                ReloadingServletFilter.class.getName(), false);
         if (webXmlRewriter.rewrite(webXmlDocument)) {
             // save web.xml
             try {
@@ -571,11 +593,23 @@ public class PrepareWebappMojo extends A
         }
     }
 
-    protected void writeLog4jXml(File webAppBaseDir) throws MojoExecutionException {
-        Map log4jTemplateMap = new HashMap();
-        log4jTemplateMap.put("useConsoleAppender", new Boolean(this.useConsoleAppender));
-        log4jTemplateMap.put("useSocketAppender", new Boolean(this.useSocketAppender));
-        this.writeStringTemplateToFile(webAppBaseDir, WEB_INF_LOG4J, this.customLog4jXconf, log4jTemplateMap);
+    protected void writeLoggingConf(Profile activeProfile, File webAppBaseDir) throws MojoExecutionException {
+        Map loggingTemplateMap = new HashMap();
+        loggingTemplateMap.put("useConsoleAppender", Boolean.valueOf(this.useConsoleAppender));
+        loggingTemplateMap.put("useSocketAppender", Boolean.valueOf(this.useSocketAppender));
+
+        switch (activeProfile) {
+            case COCOON22:
+                this.writeStringTemplateToFile(webAppBaseDir, WEB_INF_LOG4J, this.customLoggingConf, 
+                        loggingTemplateMap);
+                break;
+
+            case SSF:
+            default:
+                this.writeStringTemplateToFile(webAppBaseDir, WEB_INF_CLASSES_LOGBACK, this.customLoggingConf,
+                        loggingTemplateMap);
+                break;
+        }
     }
 
     protected void writeStringTemplateToFile(final File basedir, final String fileName, final String customFile,
@@ -584,7 +618,7 @@ public class PrepareWebappMojo extends A
         try {
             File outFile = createPath(new File(basedir, fileName));
             fos = new BufferedOutputStream(new FileOutputStream(outFile));
-            InputStream fileIs = null;
+            InputStream fileIs;
             if (customFile != null) {
                 if (new File(customFile).exists()) {
                     fileIs = new BufferedInputStream(new FileInputStream(customFile));

Modified: cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/applicationContext.xml
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/applicationContext.xml?rev=1346417&r1=1346416&r2=1346417&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/applicationContext.xml (original)
+++ cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/applicationContext.xml Tue Jun  5 15:16:51 2012
@@ -20,19 +20,22 @@
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:util="http://www.springframework.org/schema/util"
        xmlns:configurator="http://cocoon.apache.org/schema/configurator"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-                           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
-                           http://cocoon.apache.org/schema/configurator http://cocoon.apache.org/schema/configurator/cocoon-configurator-1.0.1.xsd">
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                           http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://www.springframework.org/schema/util
+                           http://www.springframework.org/schema/util/spring-util.xsd
+                           http://cocoon.apache.org/schema/configurator
+                           http://cocoon.apache.org/schema/configurator/cocoon-configurator-1.0.1.xsd">
 
   <!-- Activate Cocoon Spring Configurator -->
   <configurator:settings/>
 
-  <!-- Configure Log4j -->
-  <bean name="org.apache.cocoon.spring.configurator.log4j"
-        class="org.apache.cocoon.spring.configurator.log4j.Log4JConfigurator"
+  <!-- Configure Logback -->
+  <bean name="org.apache.cocoon.spring.configurator.logback"
+        class="org.apache.cocoon.spring.configurator.logback.LogbackConfigurator"
         scope="singleton">
     <property name="settings" ref="org.apache.cocoon.configuration.Settings"/>
-    <property name="resource" value="/WEB-INF/log4j.xml"/>
+    <property name="resource" value="/WEB-INF/logback.xml"/>
   </bean>
 
 </beans>

Added: cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/classes/logback.xml
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/classes/logback.xml?rev=1346417&view=auto
==============================================================================
--- cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/classes/logback.xml (added)
+++ cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/classes/logback.xml Tue Jun  5 15:16:51 2012
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<configuration>
+  <!--
+    - This is a sample configuration for logback.
+    - It simply just logs everything into a single log file.
+    - Note, that you can use properties for value substitution.
+  -->  
+  <appender name="CORE" class="ch.qos.logback.core.FileAppender">
+    <file>\${org.apache.cocoon.work.directory:-target/work}/cocoon.log</file>
+    <append>false</append>
+    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+      <pattern>%d %-5p %t %c - %m%n</pattern>
+    </encoder>
+  </appender>
+    
+  $if(useConsoleAppender)$
+  <appender name="CORE_CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+      <pattern>%d %-5p %t %c - %m%n</pattern>
+    </encoder>
+  </appender>
+
+  $endif$
+  $if(useSocketAppender)$
+  <appender name="CORE_SOCKET" class="ch.qos.logback.classic.net.SocketAppender">
+    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+      <pattern>%d %-5p %t %c - %m%n</pattern>
+    </encoder>
+  </appender>
+
+  $endif$  
+  <root>
+    <level value="\${org.apache.cocoon.logback.loglevel:-DEBUG}"/>
+    <appender-ref ref="CORE"/>
+    $if(useConsoleAppender)$
+    <appender-ref ref="CORE_CONSOLE"/>
+    $endif$
+    $if(useConsoleAppender)$
+    <appender-ref ref="CORE_SOCKET"/>
+    $endif$
+  </root>
+</configuration>
\ No newline at end of file

Propchange: cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/classes/logback.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/classes/logback.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/resources/org/apache/cocoon/maven/rcl/profiles/ssf/WEB-INF/classes/logback.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.