cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thorsten Scherler (JIRA)" <>
Subject [jira] [Created] (COCOON3-121) Create a generic generator that creates a root elemement and wraps the destination stream into it
Date Wed, 20 Feb 2013 18:05:13 GMT
Thorsten Scherler created COCOON3-121:

             Summary: Create a generic generator that creates a root elemement and wraps the
destination stream into it
                 Key: COCOON3-121
             Project: Cocoon 3
          Issue Type: Bug
          Components: cocoon-optional
    Affects Versions: 3.0.0-beta-1
            Reporter: Thorsten Scherler
            Assignee: Thorsten Scherler
             Fix For: 3.0.0-beta-1

If you use something like ch.qos.logback.classic.log4j.XMLLayout you can create xml based
log files. However the problem is that it does not add root element making the resulting file
not well-formed. 

You can activate the logging in your logback.xml like 

   <appender name="FAILS" class="ch.qos.logback.core.FileAppender">
        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
          <layout class="ch.qos.logback.classic.log4j.XMLLayout">

The implemented solution has the following configuration in spring:

  <bean name="generator:log4j" class="org.apache.cocoon.optional.pipeline.components.sax.generator.AddRootElementGenerator"
    <property name="encoding" value="UTF-8"/>
    <property name="localName" value="events"/>
    <property name="prefix" value="log4j"/>
    <property name="namespace" value=""/>

and later parse the file that the appender gives like:
      <map:match pattern="errorLogs">
        <map:generate src="${crawler.log.error}" type="log4j"/>
        <map:serialize type="xml" />

which will result in something like:
<?xml version="1.0" encoding="UTF-8"?>
<log4j:events xmlns:log4j="">
  <log4j:event logger="org.apache.droids.exception.ExceptionHandler" timestamp="1361325224196"
level="ERROR" thread="main">
   <log4j:message><![CDATA[org.apache.droids.core.DroidsException: org.apache.droids.core.DroidsException:
org.apache.droids.core.DroidsException: org.apache.http.client.HttpResponseException: Internal
Server Error http://localhost:8888/xxx/details/xxx]]>
  <log4j:locationInfo class="org.apache.droids.exception.ExceptionHandler" method="handleException"
file="" line="23"/>

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message