You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/06/01 11:17:00 UTC
[jira] [Commented] (LOG4NET-586) XmlLayoutSchemaLog4j throws
exception under .Net Core
[ https://issues.apache.org/jira/browse/LOG4NET-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16497858#comment-16497858 ]
ASF GitHub Bot commented on LOG4NET-586:
----------------------------------------
Github user dpsenner commented on a diff in the pull request:
https://github.com/apache/logging-log4net/pull/22#discussion_r192365918
--- Diff: src/Layout/XmlLayoutSchemaLog4jNS.cs ---
@@ -0,0 +1,282 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion
+
+using System;
+using System.Text;
+using System.Xml;
+using System.IO;
+
+using log4net.Core;
+using log4net.Util;
+
+namespace log4net.Layout
+{
+ /// <summary>
+ /// Layout that formats the log events as XML elements similar to the log4j 1.2 schema
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Formats the log events according to the
+ /// http://logging.apache.org/log4j schema and actually puts the
+ /// elements into a namespace. This may break tooling that doesn't
+ /// handle XML using namespaces.
+ /// </para>
+ /// </remarks>
+ /// <author>Nicko Cadell</author>
--- End diff --
That's probably fine, then.
> 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
> Fix For: 2.0.9
>
>
> 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)