You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by hussayn <hu...@saxess.com> on 2008/09/08 13:32:59 UTC

howto customize cocoon-2.2 logging ?

Hi;

I am searching for the correct place to change the loglevel for my
application.
But i can't figure out,  where i have to add what. Apparently i would not
do any changes in the target folder, becasue this would be overwritten with
my next
mvn jetty:run call ?

I only want to get rid of the DEBUG entries, which are generated about every
2 seconds
and sum up to Gigabytes of logfiles. Is there any pointer to some explaining
documentation ?

thanks for any help.

regards, hussayn
-- 
View this message in context: http://www.nabble.com/howto-customize-cocoon-2.2-logging---tp19370191p19370191.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: howto customize cocoon-2.2 logging ?

Posted by hussayn <hu...@saxess.com>.
I found a solution here: 

http://happygiraffe.net/blog/2008/08/27/logging-in-cocoon-22/
http://www.nabble.com/logging-with-C2.2-td13423869.html

My synthesis is:

1.) Add a configuration entry into the pom.xml of your block.
     Search for the plugin with the artifact id "cocoon-maven-plugin"

     I added a configuration tag to the end of the plugin. The whole plugin
now looks like this:

      &lt;plugin>
        &lt;groupId>org.apache.cocoon&lt;/groupId>
        &lt;artifactId>cocoon-maven-plugin&lt;/artifactId>
        &lt;version>1.0.0-M2&lt;/version>
        &lt;executions>
          &lt;execution>
            &lt;id>prepare&lt;/id>
            &lt;phase>compile&lt;/phase>
            &lt;goals>
              &lt;goal>prepare&lt;/goal>
            &lt;/goals>
          &lt;/execution>
        &lt;/executions>

        <!-- =========================================== -->
        <!-- HD: Added custom log4j configuration              -->
        <!-- The log4j-file gets copied to target/.../WEB-INF/log4j.xml -->
        <!-- =========================================== -->
        <configuration>
          
<customLog4jXconf>src/main/resources/WEB-INF/log4j.xml</customLog4jXconf>
        </configuration>

      </plugin>


2.) I created src/main/resources/WEB-INF/log4j.xml exactly as proposed by
the first link posted above.
Note: the specified folder is relative to the block root folder, so
"src/.../WEB-INF/log4j.xml" sounds good to me...

&lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    &lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
        &lt;appender name="stdout" class="org.apache.log4j.ConsoleAppender">
            &lt;param name="target" value="System.err"/>
            &lt;layout class="org.apache.log4j.PatternLayout">
                &lt;param name="ConversionPattern" value="%d{ISO8601} %c{2}
%p - %m%n"/>
            &lt;/layout>
        &lt;/appender>
        &lt;logger name="cocoon">
            &lt;level value="INFO" />
        &lt;/logger>
        &lt;logger name="org.apache.cocoon.components.flow.javascript.fom">
            &lt;level value="INFO" />
        &lt;/logger>
        &lt;root>
            &lt;priority value="WARN"/>
            &lt;appender-ref ref="stdout"/>
        &lt;/root>
    &lt;/log4j:configuration>
  
After i restarted with mvn jetty:run , the customized log4j config works and
now i can customize log4j as i need...

Maybe that helps somebody else ;-)

regards, hussayn

-- 
View this message in context: http://www.nabble.com/howto-customize-cocoon-2.2-logging---tp19370191p19380787.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org