[prev in list] [next in list] [prev in thread] [next in thread]
List: log4net-user
Subject: Re: Customize the exception output
From: "Sean Carlin" <seancarlin () gmail ! com>
Date: 2006-06-23 22:10:53
Message-ID: ad1ed7ed0606231510q3839540eja107997958c88d38 () mail ! gmail ! com
[Download RAW message or body]
Hi Ron,
I noticed that the Exception Information part can really vary per exception,
so I don't know how well a pattern output will work. It would be nice to
understand what the Enterprise Library does to figure this stuff out. I may
have to reverse engineer the code with a tool to see. Yes, Ent Lib does
spit out "Void ExecuteScripts(System.String,System.String[], Boolean,
Boolean)."
Another variation (of many, apparently):
1) Exception Information
*********************************************
Exception Type: System.Security.SecurityException
Action: 0
PermissionType: NULL
FirstPermissionThatFailed: NULL
PermissionState: NULL
Demanded: NULL
GrantedSet: NULL
RefusedSet: NULL
DenySetInstance: NULL
PermitOnlySetInstance: NULL
FailedAssemblyInfo: NULL
Method: NULL
Zone: MyComputer
Url: NULL
Message: The current user has tried to access a secure area with an
unauthorized role.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void AccessDenied(Boolean)
HelpLink: NULL
Source:
On 6/21/06, Ron Grabowski <rongrabowski@yahoo.com> wrote:
>
> My initial thought was this:
>
> <layout type="log4net.Layout.PatternLayout">
> <![CDATA[
> %counter) Exception Information
>
> *********************************************
>
> Exception Type: %exception{type}
>
> Message: %exception{message}
>
> Data: ???
>
> TargetSite: NULL
>
> HelpLink: NULL
>
> Source: NULL
> ]]>
> </layout>
>
> I don't think the current exception pattern implementation accepts
> additional parameters.
>
> I remember seeing a counter pattern somewhere but I can't seem to find
> it now.
>
> What should go in the "Data:" part of your example?
>
> Does EntLib really show this text "Void ExecuteScripts(System.String,
> System.String[], Boolean, Boolean)" or does it just show
> "ExecuteScripts"?
>
> I would create an ExtendedPatternLayout that registers additional
> converters and have your appenders use that.
>
> Create a JIRA issue if you think some of these patterns should be part
> of PatternLayout.
>
> --- Sean Carlin <seancarlin@gmail.com> wrote:
>
> > Hi,
> >
> > I've had a request from the developers at my company to modify the
> > way in
> > which log4net outputs exceptions to the log. This would need to take
> > effect
> > in my EventLogAppender and AdoNetAppender. Will I need to create my
> > own
> > custom class similar to ExceptionLayout or a custom class similar to
> > ExceptionPatternConverter? How can I specify this change to the
> > EventLogAppender?
> >
> > The request is to format the exception more like the way the .NET
> > Enterprise
> > Library did in .NET 1.1.:
> >
> >
> > 1) Exception Information
> >
> > *********************************************
> >
> > Exception Type: X.WebApps.NewsRoom.WebControls.NewsSystemException
> >
> > Message: Could not retrieve a list of articles from the category
> >
> > Data: System.Collections.ListDictionaryInternal
> >
> > TargetSite: NULL
> >
> > HelpLink: NULL
> >
> > Source: NULL
> >
> > 2) Exception Information
> >
> > *********************************************
> >
> > Exception Type: System.Exception
> >
> > Message: An error occurred while processing the required SQL script:
> > D:\WebSites\X\WebAppsFolders\WebAppsCommonFiles\\scripts\core.config
> >
> > Data: System.Collections.ListDictionaryInternal
> >
> > TargetSite: Void ExecuteScripts(System.String, System.String[],
> > Boolean,
> > Boolean)
> >
> > HelpLink: NULL
> >
> > Source: X.WebApps.CoreLibrary.X.X
> >
> > StackTrace Information
> >
> > *********************************************
> >
> > at X.WebApps.CoreSystem.ExecuteScripts(String path, String[] scripts,
> > Boolean trapExceptions, Boolean sendAppPath)
> >
> > at X.WebApps.CoreSystem.SystemInit()
> >
> > at X.WebApps.CoreSystem..ctor(String application)
> >
> > at
> >
>
> X.WebApps.NewsRoom.WebControls.NewsArticleDisplayer.GetNewsArticleAndCategory
> (Category&
> > newsCategory, Article& newsArticle)
> >
> > Here is a sample of what is being output by the default format:
> >
> > System.Exception: Testing application error handling from the
> > DevCenter/ApplicationErrorTest.aspx form. --->
> > System.ArrayTypeMismatchException: Oh my gosh some sort of array
> > mismatch
> > occurred in this fake class! Error! Error!
> > at RemoteNet.Zapenza.Utility.TestClass..ctor() in
> >
>
> C:\Solutions\CIProjects\RemoteNet\Zapenza\Working\Source\RemoteNet.Zapenza.Utility\TestClass.cs:line
>
> > 11
> > at DevCenter_ApplicationErrorTest.lnkApplicationError_Click(Object
> > sender,
> > EventArgs e) in
> >
>
> c:\Solutions\CIProjects\RemoteNet\Zapenza\Working\Source\RemoteNet.Zapenza.Web.UI\DevCenter\ApplicationErrorTest.aspx.cs:line
>
> > 24
> > --- End of inner exception stack trace ---
> > at DevCenter_ApplicationErrorTest.lnkApplicationError_Click(Object
> > sender,
> > EventArgs e) in
> >
>
> c:\Solutions\CIProjects\RemoteNet\Zapenza\Working\Source\RemoteNet.Zapenza.Web.UI\DevCenter\ApplicationErrorTest.aspx.cs:line
>
> > 28
> > at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)
> > at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
> > eventArgument)
> > at
> >
>
> System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent
> (String
> > eventArgument)
> > at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
> > sourceControl, String eventArgument)
> > at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
> > postData)
> > at System.Web.UI.Page.ProcessRequestMain(Boolean
> > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
> >
>
>
[Attachment #3 (text/html)]
Hi Ron,<br><br>I noticed that the Exception Information part can really vary per \
exception, so I don't know how well a pattern output will work. It would be \
nice to understand what the Enterprise Library does to figure this stuff out. I \
may have to reverse engineer the code with a tool to see. Yes, Ent Lib does \
spit out "Void ExecuteScripts( System.String,System.String[], Boolean, \
Boolean)."<br><br>Another variation (of many, apparently):<br><br>1) Exception \
Information<br>*********************************************<br>Exception Type: \
System.Security.SecurityException <br>Action: 0<br>PermissionType: \
NULL<br>FirstPermissionThatFailed: NULL<br>PermissionState: NULL<br>Demanded: \
NULL<br>GrantedSet: NULL<br>RefusedSet: NULL<br>DenySetInstance: \
NULL<br>PermitOnlySetInstance: NULL<br>FailedAssemblyInfo: NULL <br>Method: \
NULL<br>Zone: MyComputer<br>Url: NULL<br>Message: The current user has tried to \
access a secure area with an unauthorized role.<br>Data: \
System.Collections.ListDictionaryInternal<br>TargetSite: Void AccessDenied(Boolean) \
<br>HelpLink: NULL<br>Source:<br><br><br><br><div><span class="gmail_quote">On \
6/21/06, <b class="gmail_sendername">Ron Grabowski</b> <<a \
href="mailto:rongrabowski@yahoo.com">rongrabowski@yahoo.com</a>> wrote:</span> \
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">My initial thought was \
this:<br><br><layout type="log4net.Layout.PatternLayout"> \
<br><![CDATA[<br>%counter) Exception \
Information<br><br>*********************************************<br><br>Exception \
Type: %exception{type}<br><br>Message: %exception{message}<br><br>Data: \
???<br><br>TargetSite: NULL <br><br>HelpLink: NULL<br><br>Source: \
NULL<br>]]><br></layout><br><br>I don't think the current exception pattern \
implementation accepts<br>additional parameters.<br><br>I remember seeing a counter \
pattern somewhere but I can't seem to find <br>it now.<br><br>What should go in the \
"Data:" part of your example?<br><br>Does EntLib really show this text \
"Void ExecuteScripts(System.String,<br>System.String[], Boolean, Boolean)" \
or does it just show <br>"ExecuteScripts"?<br><br>I would create an \
ExtendedPatternLayout that registers additional<br>converters and have your appenders \
use that.<br><br>Create a JIRA issue if you think some of these patterns should be \
part <br>of PatternLayout.<br><br>--- Sean Carlin <<a \
href="mailto:seancarlin@gmail.com">seancarlin@gmail.com</a>> \
wrote:<br><br>> Hi,<br>><br>> I've had a request from the \
developers at my company to modify the <br>> way in<br>> which log4net outputs \
exceptions to the log. This would need to take<br>> effect<br>> in \
my EventLogAppender and AdoNetAppender. Will I need to create my<br>> \
own<br>> custom class similar to ExceptionLayout or a custom class similar to \
<br>> ExceptionPatternConverter? How can I specify this change to \
the<br>> EventLogAppender?<br>><br>> The request is to format the exception \
more like the way the .NET<br>> Enterprise<br>> Library did in .NET \
1.1.:<br>><br>><br>> 1) Exception Information<br>><br>> \
*********************************************<br>><br>> Exception Type: \
X.WebApps.NewsRoom.WebControls.NewsSystemException<br>><br>> Message: Could not \
retrieve a list of articles from the category <br>><br>> Data: \
System.Collections.ListDictionaryInternal<br>><br>> TargetSite: \
NULL<br>><br>> HelpLink: NULL<br>><br>> Source: NULL<br>><br>> 2) \
Exception Information<br>><br>> ********************************************* \
<br>><br>> Exception Type: System.Exception<br>><br>> Message: An error \
occurred while processing the required SQL script:<br>> \
D:\WebSites\X\WebAppsFolders\WebAppsCommonFiles\\scripts\core.config<br>><br> > \
Data: System.Collections.ListDictionaryInternal<br>><br>> TargetSite: Void \
ExecuteScripts(System.String, System.String[],<br>> Boolean,<br>> \
Boolean)<br>><br>> HelpLink: NULL<br>><br>> Source: \
X.WebApps.CoreLibrary.X.X<br>><br>> StackTrace Information<br>><br>> \
*********************************************<br>><br>> at \
X.WebApps.CoreSystem.ExecuteScripts(String path, String[] scripts,<br>> Boolean \
trapExceptions, Boolean sendAppPath) <br>><br>> at \
X.WebApps.CoreSystem.SystemInit()<br>><br>> at \
X.WebApps.CoreSystem..ctor(String application)<br>><br>> \
at<br>><br>X.WebApps.NewsRoom.WebControls.NewsArticleDisplayer.GetNewsArticleAndCategory
(Category&<br>> newsCategory, Article& newsArticle)<br>><br>> Here \
is a sample of what is being output by the default format:<br>><br>> \
System.Exception: Testing application error handling from the<br> > \
DevCenter/ApplicationErrorTest.aspx form. ---><br>> \
System.ArrayTypeMismatchException: Oh my gosh some sort of array<br>> \
mismatch<br>> occurred in this fake class! Error! Error!<br>> at \
RemoteNet.Zapenza.Utility.TestClass..ctor () \
in<br>><br>C:\Solutions\CIProjects\RemoteNet\Zapenza\Working\Source\RemoteNet.Zapenza.Utility\TestClass.cs:line<br>> \
11<br>> at DevCenter_ApplicationErrorTest.lnkApplicationError_Click(Object<br>> \
sender,<br> > EventArgs e) \
in<br>><br>c:\Solutions\CIProjects\RemoteNet\Zapenza\Working\Source\RemoteNet.Zapenza.Web.UI\DevCenter\ApplicationErrorTest.aspx.cs:line<br>> \
24<br>> --- End of inner exception stack trace ---<br> > at \
DevCenter_ApplicationErrorTest.lnkApplicationError_Click(Object<br>> \
sender,<br>> EventArgs e) \
in<br>><br>c:\Solutions\CIProjects\RemoteNet\Zapenza\Working\Source\RemoteNet.Zapenza.Web.UI\DevCenter\ApplicationErrorTest.aspx.cs:line
<br>> 28<br>> at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs \
e)<br>> at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String<br>> \
eventArgument)<br>> \
at<br>><br>System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent
(String<br>> eventArgument)<br>> at \
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler<br>> sourceControl, \
String eventArgument)<br>> at \
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection<br>> postData) <br>> \
at System.Web.UI.Page.ProcessRequestMain(Boolean<br>> \
includeStagesBeforeAsyncPoint, Boolean \
includeStagesAfterAsyncPoint)<br>><br><br></blockquote></div><br>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic