Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-586

XmlLayoutSchemaLog4j throws exception under .Net Core

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.8
    • Fix Version/s: 2.1.0
    • Component/s: Other
    • Labels:
      None
    • Environment:
      .Net Core 1.1 on Windows

      Description

      Hi,

      When using XmlLayoutSchemaLog4j layout with .Net Core, the following exception appears:

      {quote}System.ArgumentException: Invalid name character in 'log4j:event'. The ':' character, hexadecimal value 0x0x3A, cannot be included in a name.{quote}
      

      I made a copy of XmlLayoutSchemaLog4j.cs in my sources, and found the culprit:

      writer.WriteStartElement("log4j:event");
      

      XmlWriter.WriteStartElement is called wrongly, the namespace should be a separate argument:

      writer.WriteStartElement("event", "log4j");
      

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                pyb@camag Pierre-Yann Bridé
              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: