Index: netstandard/log4net.tests/log4net.tests.xproj =================================================================== --- netstandard/log4net.tests/log4net.tests.xproj (revision 1782185) +++ netstandard/log4net.tests/log4net.tests.xproj (working copy) @@ -32,6 +32,7 @@ + Index: netstandard/log4net.tests/project.json =================================================================== --- netstandard/log4net.tests/project.json (revision 1782185) +++ netstandard/log4net.tests/project.json (working copy) @@ -6,6 +6,7 @@ "../../tests/src/Appender/AppenderCollectionTest.cs", "../../tests/src/Appender/BufferingAppenderTest.cs", "../../tests/src/Appender/CountingAppender.cs", + "../../tests/src/Appender/DebugAppenderTest.cs", "../../tests/src/Appender/MemoryAppenderTest.cs", "../../tests/src/Appender/RollingFileAppenderTest.cs", "../../tests/src/Appender/SmtpPickupDirAppenderTest.cs", Index: netstandard/log4net/log4net.xproj =================================================================== --- netstandard/log4net/log4net.xproj (revision 1782185) +++ netstandard/log4net/log4net.xproj (working copy) @@ -157,6 +157,7 @@ + Index: src/Appender/DebugAppender.cs =================================================================== --- src/Appender/DebugAppender.cs (revision 1782185) +++ src/Appender/DebugAppender.cs (working copy) @@ -100,6 +100,23 @@ set { m_immediateFlush = value; } } + /// + /// Formats the category parameter sent to the Debug method. + /// + /// + /// + /// Defaults to a with %logger as the pattern which will use the logger name of the current + /// as the category parameter. + /// + /// + /// + /// + public LayoutSkeleton Category + { + get { return m_category; } + set { m_category = value; } + } + #endregion Public Instance Properties #if !NETSTANDARD1_3 @@ -138,7 +155,7 @@ // // Write the string to the Debug system // - System.Diagnostics.Debug.Write(RenderLoggingEvent(loggingEvent), loggingEvent.LoggerName); + System.Diagnostics.Debug.Write(RenderLoggingEvent(loggingEvent), m_category.Format(loggingEvent)); #if !NETSTANDARD1_3 // // Flush the Debug system if needed @@ -185,6 +202,11 @@ /// private bool m_immediateFlush = true; + /// + /// Defaults to a with %logger as the pattern. + /// + private LayoutSkeleton m_category = new PatternLayout("%logger"); + #endregion Private Instance Fields } } Index: src/Appender/TraceAppender.cs =================================================================== --- src/Appender/TraceAppender.cs (revision 1782185) +++ src/Appender/TraceAppender.cs (working copy) @@ -112,17 +112,17 @@ } /// - /// The category parameter sent to the Trace method. + /// Formats the category parameter sent to the Trace method. /// /// /// - /// Defaults to %logger which will use the logger name of the current + /// Defaults to a with %logger as the pattern which will use the logger name of the current /// as the category parameter. /// /// /// /// - public PatternLayout Category + public LayoutSkeleton Category { get { return m_category; } set { m_category = value; } @@ -201,9 +201,9 @@ private bool m_immediateFlush = true; /// - /// Defaults to %logger + /// Defaults to a with %logger as the pattern. /// - private PatternLayout m_category = new PatternLayout("%logger"); + private LayoutSkeleton m_category = new PatternLayout("%logger"); #endregion Private Instance Fields Index: src/Layout/LayoutSkeleton.cs =================================================================== --- src/Layout/LayoutSkeleton.cs (revision 1782185) +++ src/Layout/LayoutSkeleton.cs (working copy) @@ -147,7 +147,7 @@ /// /// Creates a new StringWriter instance to store the formatted logging event. /// - public string Format(LoggingEvent loggingEvent) + public virtual string Format(LoggingEvent loggingEvent) { StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture); Format(writer, loggingEvent); Index: src/Layout/ReturnsNullLayout.cs =================================================================== --- src/Layout/ReturnsNullLayout.cs (nonexistent) +++ src/Layout/ReturnsNullLayout.cs (working copy) @@ -0,0 +1,68 @@ +#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.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using log4net.Core; + +namespace log4net.Layout +{ + /// + /// A layout that does nothing. Use this in case you want the appender to print nothing + /// regardless of the logging event. + /// + /// This can be usefull when used with the or the + /// properties. + /// + public class ReturnsNullLayout : LayoutSkeleton + { + /// + /// This method is a NOOP for this Layout + /// + public override void ActivateOptions() + { + // NOOP + } + + /// + /// This method is a NOOP for this layout + /// + /// + /// The LoggingEvent that will not be rendered + public override void Format(TextWriter writer, LoggingEvent loggingEvent) + { + // NOOP + } + + /// + /// Always returns null + /// + /// The LoggingEvent that will not be rendered + /// + public override string Format(LoggingEvent loggingEvent) + { + return null; + } + } +} + Index: src/log4net.vs2008.csproj =================================================================== --- src/log4net.vs2008.csproj (revision 1782185) +++ src/log4net.vs2008.csproj (working copy) @@ -484,6 +484,9 @@ Code + + Code + Code Index: src/log4net.vs2010.csproj =================================================================== --- src/log4net.vs2010.csproj (revision 1782185) +++ src/log4net.vs2010.csproj (working copy) @@ -500,6 +500,7 @@ Code + Code Index: src/log4net.vs2012.csproj =================================================================== --- src/log4net.vs2012.csproj (revision 1782185) +++ src/log4net.vs2012.csproj (working copy) @@ -1,4 +1,4 @@ - +