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

Stefan Bodewig commented on LOG4NET-209:
----------------------------------------

FormatXml is protected ;-)

I haven't written the code and haven't been around when it was written, so I 
don't know why it it works as it does.  It looks as if FormatXml was only 
expected to be used as part of the Format template method in XmlLayoutBase (and 
has to be protected for things to work, of course).

Actually I had started to implement either of your two approaches before I 
commented and then ran into the exception (i overlooked the Namespace=false 
line intially).  The unit test relies on the behavior that no prefix will be 
added unless ActivateOptions has been called (which the test doesn't do), not 
sure whether this is imporatant to retain.

Yes, I'd be willing to accept a patch if it was backwards compatible and passes 
the existing tests without changing them.  Bonus points if you add new tests 8-)

Even though I'd prefer to get rid of the pre-built element names option 1 seems 
to be more in line with the original intentions of the existing code and I feel 
conservative right now - at least until we've released 1.2.11.

> XmlLayout.FormatXml calls wrong overload of XmlWriter.WriteStartElement
> -----------------------------------------------------------------------
>
>                 Key: LOG4NET-209
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-209
>             Project: Log4net
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 1.2.10
>         Environment: .NET 3.5 SP1
>            Reporter: Matthew Gabeler-Lee
>
> FormatXml calls WriteStartElement using prefixed element names (e.g. 
> "log4net:event"), but it calls the overload of WriteStartElement that expects 
> a local name.  Thus, if it writes to an xml writer that actually checks such 
> things, it crashes.  Instead, it should call the overload that separates the 
> prefix from the local name.  E.g.:  writer.WriteStartElement(this.m_prefix, 
> this.m_elmEvent, null).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to