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

Broken XmlLayoutSchemaLog4j

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.14
    • None
    • Layouts
    • Windows 11 Professional, Windows 10 Professional, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019
      .NET Framework 4.5.2

    Description

      After updating from version 2.0.8 to 2.0.14, using XmlLayoutSchemaLog4j seems to be broken resulting in a following error:

      System.ArgumentException: Cannot set the namespace if Namespaces is 'false'.
         at System.Xml.XmlTextWriter.WriteStartElement(String prefix, String localName, String ns)
         at log4net.Layout.XmlLayoutSchemaLog4j.FormatXml(XmlWriter writer, LoggingEvent loggingEvent)
         at log4net.Layout.XmlLayoutBase.Format(TextWriter writer, LoggingEvent loggingEvent)
         at log4net.Appender.AppenderSkeleton.RenderLoggingEvent(TextWriter writer, LoggingEvent loggingEvent)
         at log4net.Appender.TextWriterAppender.Append(LoggingEvent loggingEvent)
         at log4net.Appender.FileAppender.Append(LoggingEvent loggingEvent)
         at log4net.Appender.RollingFileAppender.Append(LoggingEvent loggingEvent)

      Configuration is initialized by executing XmlConfigurator, where Stream is pointing to configuration.xml

      log4net.Config.XmlConfigurator.Configure(Stream configStream); 

      After some digging I belive for it to be related to https://github.com/apache/logging-log4net/pull/18 which was introduced in version 2.0.13 under Bug fixes section

      Attachments

        1. configuration.xml
          0.7 kB
          Maciej Stiller

        Issue Links

          Activity

            People

              Unassigned Unassigned
              maciej.stiller Maciej Stiller
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: