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

XmlLayoutSchemaLog4j throws exception under .Net Core

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.8
    • 2.1.0
    • Other
    • None
    • .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

              Unassigned Unassigned
              pyb@camag Pierre-Yann Bridé
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m