bufanliu / as3-commons

Automatically exported from code.google.com/p/as3-commons
0 stars 0 forks source link

Chainsaw gateway generates malformed XML #141

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Create a logger using ChainsawTarget
2.Run application
3.

What is the expected output? What do you see instead?
Expect a logger to be created by chainsaw.
XML parsing errors reported by chainsaw.

What version of the product are you using? On what operating system?
1.7

Please provide any additional information below.
The problems is that the write statement in ChainsawGateway fails to properly 
terminate the CDATA element that it starts.

The following patch fixes the problem for me.

Index: 
src/main/actionscript/org/as3commons/logging/setup/target/ChainsawGateway.as
===================================================================
--- 
src/main/actionscript/org/as3commons/logging/setup/target/ChainsawGateway.as    (re
vision 1908)
+++ 
src/main/actionscript/org/as3commons/logging/setup/target/ChainsawGateway.as    (wo
rking copy)
@@ -66,7 +66,7 @@
         */
        public function log(name:String, time:Number, level:int, message:String): void {
            doLog('<log4j:event logger="'+name+'" timestamp="'+(START_TIME+time)+'" level="'+LEVEL_NAMES[level]+'" thread="'+_applicationThread+'" xmlns:log4j="http://jakarta.apache.org/log4j/">'
-                   + '<log4j:message><![CDATA['+message.replace(/\<\!\[CDATA\[/gi, 
"").replace(/\]\]\>/gi, "")+'</log4j:message>'
+                   + '<log4j:message><![CDATA['+message.replace(/\<\!\[CDATA\[/gi, 
"").replace(/\]\]\>/gi, "")+']]></log4j:message>'
                    + '<log4j:properties><log4j:data name="application" value="'+_applicationName+'" /></log4j:properties>'
                + '</log4j:event>');
        }

Original issue reported on code.google.com by samuelso...@gmail.com on 31 May 2013 at 12:36