You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Ron Grabowski (JIRA)" <ji...@apache.org> on 2006/07/29 16:44:14 UTC

[jira] Commented: (LOG4NET-77) A small improvement of log4net.Layout.Pattern.ExceptionPatternConverter - added 'Option' propery support

    [ http://issues.apache.org/jira/browse/LOG4NET-77?page=comments#action_12424298 ] 
            
Ron Grabowski commented on LOG4NET-77:
--------------------------------------

Which one of the two Assert statements are correct? StackTrace is null.

[Test]
public void TestExceptionPattern()
{
	StringAppender stringAppender = new StringAppender();
	PatternLayout layout = new PatternLayout("%exception{stacktrace}");
	stringAppender.Layout = layout;

	ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
	BasicConfigurator.Configure(rep, stringAppender);

	ILog log1 = LogManager.GetLogger(rep.Name, "TestExceptionPattern");

	Exception exception = new Exception("Oh no!");
	log1.Info("TestMessage", exception);

	/* From ExceptionPatternConverter.cs:
		If there is no exception then nothing will be output
		and no trailing newline will be appended.
		It is typical to put a newline before the exception
		and to have the exception as the last data in the pattern.
	*/

	// ???
	Assert.AreEqual(string.Empty, stringAppender.GetString());

	// ???
	Assert.AreEqual(SystemInfo.NullText, stringAppender.GetString());

	stringAppender.Reset();	
}

> A small improvement of log4net.Layout.Pattern.ExceptionPatternConverter  - added 'Option' propery support
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-77
>                 URL: http://issues.apache.org/jira/browse/LOG4NET-77
>             Project: Log4net
>          Issue Type: Improvement
>    Affects Versions: 1.2.10
>            Reporter: Imrich Olha
>         Assigned To: Ron Grabowski
>            Priority: Minor
>         Attachments: ExceptionPatternConverter-WithOptionSupport.cs.patch, ExceptionPatternConverter.cs
>
>
> A small improvement of log4net.Layout.Pattern.ExceptionPatternConverter  - added 'Option' propery support
> Example of usage:
>     <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
>       <layout type="log4net.Layout.PatternLayout">
>         <conversionPattern value="%exception{TargetSite} - %exception{Message}%newline" />
>       </layout>
>     </appender>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira