[ 
https://issues.apache.org/jira/browse/LOG4NET-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16439574#comment-16439574
 ] 

Massimo Del Zotto commented on LOG4NET-586:
-------------------------------------------

Hello,

I stumbled in this bug while porting our program to .net standard.

I built an internal log4net version where all the +WriteStartElement+ calls in 
XmlLayoutSchemaLog4j.cs are replaced as proposed by [~pyb@camag]. The result is 
like

 
{code:java}
<event logger="l4jexample.Program" timestamp="1523891132438" level="DEBUG" 
thread="Main" xmlns="log4j"><message>Blah blah</message><properties><data 
name="log4net:HostName" value="host_name" /><data name="log4japp" value="NOT 
AVAILABLE" /><data name="log4jmachinename" value="mach_name" /><data 
name="log4net:Identity" value="NOT AVAILABLE" /><data name="log4net:UserName" 
value="NOT AVAILABLE" /></properties></event>

{code}
Somehow this does not seem to parse correctly in Chainsaw for me; in the sense 
nothing gets displayed. Chainsaw does not even emit messages in its 
chainsaw-log.

For the time being I'm worried the output is not equivalent.

Note in particular internal tags such as <message> do not get the xmlns 
annotation albeit I have modified their calls as well.

I will be investigating alternatives in the next few days.

 

> XmlLayoutSchemaLog4j throws exception under .Net Core
> -----------------------------------------------------
>
>                 Key: LOG4NET-586
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-586
>             Project: Log4net
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 2.0.8
>         Environment: .Net Core 1.1 on Windows
>            Reporter: Pierre-Yann Bridé
>            Priority: Major
>
> Hi,
> When using XmlLayoutSchemaLog4j layout with .Net Core, the following 
> exception appears:
> {code:java}
> {quote}System.ArgumentException: Invalid name character in 'log4j:event'. The 
> ':' character, hexadecimal value 0x0x3A, cannot be included in a name.{quote}
> {code}
> I made a copy of XmlLayoutSchemaLog4j.cs in my sources, and found the culprit:
> {code:java}
> writer.WriteStartElement("log4j:event");
> {code}
> XmlWriter.WriteStartElement is called wrongly, the namespace should be a 
> separate argument:
> {code:java}
> writer.WriteStartElement("event", "log4j");
> {code}
> I corrected all WriteStartElement in my copy, and it now works fine. I hope 
> that you can put this small change in the next version.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to