logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Abramov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4NET-559) Custom Appender throws exception to user when I use %type in ConversionPattern
Date Mon, 13 Mar 2017 22:15:41 GMT

    [ https://issues.apache.org/jira/browse/LOG4NET-559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15923074#comment-15923074
] 

Denis Abramov commented on LOG4NET-559:
---------------------------------------

If I remove %type from the conversion string everything works again

> Custom Appender throws exception to user when I use %type in ConversionPattern
> ------------------------------------------------------------------------------
>
>                 Key: LOG4NET-559
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-559
>             Project: Log4net
>          Issue Type: Bug
>    Affects Versions: 2.0.7
>            Reporter: Denis Abramov
>
> In my appender I have the following ConversionPattern:
>   <layout type="log4net.Layout.PatternLayout">
>         <param name="ConversionPattern" value="%m%n&#13;&#10;%type" />
>    </layout>
> In my Append method, the "RenderLoggingEvent" is throwing the exception below
>  protected override void Append(LoggingEvent loggingEvent) {
>        ...       
>                 message.ErrorText = Layout == null ? loggingEvent.RenderedMessage : RenderLoggingEvent(loggingEvent);
>             }
>        ...
> }
> System.NullReferenceException was unhandled by user code
>   HResult=-2147467261
>   Message=Object reference not set to an instance of an object.
>   Source=log4net
>   StackTrace:
>        at log4net.Layout.Pattern.TypeNamePatternConverter.GetFullyQualifiedName(LoggingEvent
loggingEvent) in c:\log4net\tags\2.0.7RC1\src\Layout\Pattern\TypeNamePatternConverter.cs:line
51
>        at log4net.Layout.Pattern.NamedPatternConverter.Convert(TextWriter writer, LoggingEvent
loggingEvent) in c:\log4net\tags\2.0.7RC1\src\Layout\Pattern\NamedPatternConverter.cs:line
125
>        at log4net.Util.PatternConverter.Format(TextWriter writer, Object state) in c:\log4net\tags\2.0.7RC1\src\Util\PatternConverter.cs:line
173
>        at log4net.Layout.PatternLayout.Format(TextWriter writer, LoggingEvent loggingEvent)
in c:\log4net\tags\2.0.7RC1\src\Layout\PatternLayout.cs:line 1117
>        at log4net.Appender.AppenderSkeleton.RenderLoggingEvent(LoggingEvent loggingEvent)
in c:\log4net\tags\2.0.7RC1\src\Appender\AppenderSkeleton.cs:line 705
>        at MyAppender.MyAppender.Append(LoggingEvent loggingEvent) in E:\svn\trunk\MyAppender\MyAppender.cs:line
67
>        at log4net.Appender.AppenderSkeleton.DoAppend(LoggingEvent loggingEvent) in c:\log4net\tags\2.0.7RC1\src\Appender\AppenderSkeleton.cs:line
317
>   InnerException: 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message