cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@apache.org
Subject svn commit: r473917 - in /cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main: java/org/apache/cocoon/maven/deployer/ java/org/apache/cocoon/maven/deployer/monolithic/ resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/c...
Date Sun, 12 Nov 2006 10:44:06 GMT
Author: giacomo
Date: Sun Nov 12 02:44:05 2006
New Revision: 473917

URL: http://svn.apache.org/viewvc?view=rev&rev=473917
Log:
add possibility to use a ConsoleAppender in the genrated log4j.xconf so that running in Eclipse
shows the log

Modified:
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/cocoon/log4j.xconf

Modified: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java?view=diff&rev=473917&r1=473916&r2=473917
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java
(original)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java
Sun Nov 12 02:44:05 2006
@@ -173,13 +173,20 @@
     private boolean useShieldingRepository = true;
 
     /**
+     * Use console appender
+     * 
+     * @parameter expression="${maven.war.log4j.useConsoleAppender}"
+     */
+    private boolean useConsoleAppender = false;
+
+    /**
      * Deploy a monolithic Cocoon web application. This means it doesn't use the
      * features that the blocks-fw offers.
      */
     protected void deployMonolithicCocoonAppAsWebapp(final String blocksdir) throws MojoExecutionException,
MojoFailureException {
         this.buildExplodedWebapp(getWebappDirectory());
         MonolithicCocoonDeployer deployer = new MonolithicCocoonDeployer(this.getLog());
-        deployer.deploy(getBlockArtifactsAsMap(null), getWebappDirectory(), blocksdir);
+        deployer.deploy(getBlockArtifactsAsMap(null), getWebappDirectory(), blocksdir, useConsoleAppender);
 
         // make sure that all configuration files available in the webapp
         // override block configuration files
@@ -229,7 +236,7 @@
 
         // deploy all blocks
         MonolithicCocoonDeployer deployer = new MonolithicCocoonDeployer(this.getLog());
-        deployer.deploy(getBlockArtifactsAsMap(blocks), getWebappDirectory(), blocksdir,
extBlocks, properties);
+        deployer.deploy(getBlockArtifactsAsMap(blocks), getWebappDirectory(), blocksdir,
extBlocks, properties, useConsoleAppender);
 
         if (useShieldingClassloader)
             shieldCocoonWebapp();

Modified: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java?view=diff&rev=473917&r1=473916&r2=473917
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java
(original)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java
Sun Nov 12 02:44:05 2006
@@ -26,7 +26,6 @@
 import java.io.OutputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.URL;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -55,12 +54,12 @@
         this.logger = logger;
     }
 
-    public void deploy(final Map libraries, final File basedir, final String blocksdir) throws
DeploymentException {
-        deploy(libraries, basedir, blocksdir, new DevelopmentBlock[0], new DevelopmentProperty[0]);
+    public void deploy(final Map libraries, final File basedir, final String blocksdir, final
boolean useConsoleAppender) throws DeploymentException {
+        deploy(libraries, basedir, blocksdir, new DevelopmentBlock[0], new DevelopmentProperty[0],
useConsoleAppender);
     }
 
     public void deploy(final Map libraries, final File basedir, final String blocksdir,
-            final DevelopmentBlock[] developmentBlocks, DevelopmentProperty[] developmentProperties)
+            final DevelopmentBlock[] developmentBlocks, DevelopmentProperty[] developmentProperties,
final boolean useConsoleAppender)
             throws DeploymentException {
 
 
@@ -98,11 +97,15 @@
             Map templateObjects = new HashMap();
             templateObjects.put("devblocks", developmentBlocks);
             templateObjects.put("curblock", developmentBlocks[developmentBlocks.length -
1]);
+            if (useConsoleAppender) {
+                templateObjects.put("useConsoleAppender", "useConsoleAppender" );
+            }
             writeStringTemplateToFile(basedir, "sitemap.xmap", templateObjects);
             writeStringTemplateToFile(basedir, "WEB-INF/cocoon/cocoon.xconf", templateObjects);
 
             copyFile(basedir, "blocks/sitemap.xmap");
-            copyFile(basedir, "WEB-INF/cocoon/log4j.xconf");
+            //copyFile(basedir, "WEB-INF/cocoon/log4j.xconf");
+            writeStringTemplateToFile(basedir, "WEB-INF/cocoon/log4j.xconf", templateObjects);
             // copyFile(basedir, "WEB-INF/web.xml");
 
             for (int i = 0; i < developmentBlocks.length; ++i) {

Modified: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/cocoon/log4j.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/cocoon/log4j.xconf?view=diff&rev=473917&r1=473916&r2=473917
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/cocoon/log4j.xconf
(original)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/cocoon/log4j.xconf
Sun Nov 12 02:44:05 2006
@@ -23,15 +23,24 @@
          Note, that you can use properties for value substitution.
     -->
     <appender name="COCOON_DEFAULT" class="org.apache.log4j.FileAppender">
-        <param name="File"   value="${log-dir}/log4j.log" />
+        <param name="File"   value="\${log-dir}/log4j.log" />
         <param name="Append" value="false" />	    	
         <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
         </layout>	    
     </appender>
 
+    $if(useConsoleAppender)$
+    <appender name="COCOON_DEFAULT_CONSOLE" class="org.apache.log4j.ConsoleAppender">
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
+        </layout>	    
+    </appender>
+    $endif$
+
     <root>
-      <priority value="${org.apache.cocoon.log4j.loglevel}"/>
+      <priority value="\${org.apache.cocoon.log4j.loglevel}"/>
       <appender-ref ref="COCOON_DEFAULT" />
+      <appender-ref ref="COCOON_DEFAULT_CONSOLE" />
     </root>
 </log4j:configuration>



Mime
View raw message