Added by James Curran, last edited by James Curran on Mar 04, 2009
( view change)
WebTraceExtension Class
This extension appends the ASP.NET Tracing diagnostic information and custom tracing messages to the output of the page and sends this information to the requesting browser, just as if <% @Page trace="true" /> had been specified on an aspx page. public class WebTraceExtension
Remarks
To install this extension you must register the extension on the extensions node and add the element webtrace under the monoRail configuration node.
<monoRail>
<extensions>
<extension type="Castle.MonoRail.Framework.Extensions.WebTraceExtension, Castle.MonoRail.ViewComponents" />
</extensions>
<webtrace enabled="true" includePropertyBag="true" htmlOnly="true" />
</monoRail>
The webtrace tag accepts three attributes.
| Attribute |
Description |
| enabled |
Turns output on and off. Must be set to true is see anything. Defaults to false |
| includePropertyBag |
If set to true, the PropertyBag and Flash dictionaries are displayed in the Application and Session variables sections, respectively, of the output. Defaults to false |
| htmlOnly |
If set to true (the default) trace output is only appended to Html pages. Output will be supressed for all responses where the ContentType is not "text/html" or where the Request headers include "x-requested-with: XMLHttpRequest". Since the responses where the output is suppressed are rarely displayed in a browser, or have very specific formatting (e.g. XML or JSON), there is rarely a need to set this to false. |
Example output (appended to end of generated webpage, excerpted)
(Wiki Markup has mangled the example a bit. Actual output look just like (and in fact, is) the standard ASP.NET trace.
Request Details |
| Session Id: |
|
Request Type: |
GET |
| Time of Request: |
3/3/2009 9:49:15 PM |
Status Code: |
|
| Request Encoding: |
Unicode (UTF-8) |
Response Encoding: |
|
Trace Information |
| Category |
Message |
From First(s) |
From Last(s) |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultControllerDescriptorProvider Building controller descriptor for StateTheater.Controllers.ShowController |
|
|
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultHelperDescriptorProvider Collecting helpers for StateTheater.Controllers.ShowController |
0.000339917503481588 |
0.000340 |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultResourceDescriptorProvider Collecting resources information for ShowController |
0.0465392947986406 |
0.046199 |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultFilterDescriptorProvider Collecting filters for StateTheater.Controllers.ShowController |
0.0716364090966869 |
0.025097 |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultFilterDescriptorProvider Collected filter Castle.MonoRail.Framework.Filters.MobileFilter to execute Before order 2147483647 |
0.142982138791383 |
0.071346 |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultLayoutDescriptorProvider Collecting layout information for ShowController |
0.143188240404856 |
0.000206 |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultRescueDescriptorProvider Collecting rescue information for ShowController |
0.143436805515785 |
0.000249 |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultRescueDescriptorProvider Collected rescue with view name generalerror for exception type System.Exception |
0.143640672208339 |
0.000204 |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultDynamicActionProviderDescriptorProvider Collecting dynamic action providers for StateTheater.Controllers.ShowController |
0.143868354776934 |
0.000228 |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultControllerDescriptorProvider Collection attributes for action GetCastJson |
0.144718253297556 |
0.000850 |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultResourceDescriptorProvider Collecting resources information for GetCastJson |
0.144868831094455 |
0.000151 |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultRescueDescriptorProvider Collecting rescue information for GetCastJson |
0.161683468150282 |
0.016815 |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultLayoutDescriptorProvider Collecting layout information for GetCastJson |
0.161927703101931 |
0.000244 |
| [Debug] |
Castle.MonoRail.Framework.Providers.DefaultControllerDescriptorProvider Collection attributes for action Photos |
0.162220128535889 |
0.000292 |
[snip]
| [Debug] |
Castle.MonoRail.Framework.Services.DefaultCacheProvider Getting entry with key layouts\default.vm |
20.173771736352 |
0.365545 |
| [Debug] |
Castle.MonoRail.Framework.Services.DefaultCacheProvider Storing entry layouts\default.vm with data Castle.MonoRail.Framework.Views.NVelocity.CustomTemplate |
20.2467382027604 |
0.072966 |
| [Info] |
Castle.MonoRail.ViewComponents.MenuComponent <ul id="mainMenu" class="Menu MenuFrame"> |
21.1747492348888 |
0.928011 |
| [Info] |
Castle.MonoRail.ViewComponents.MenuComponent <ul id="Menu:128573ec" class="Menu SubMenu"> |
21.1768086446741 |
0.002059 |
| [Info] |
Castle.MonoRail.ViewComponents.MenuComponent <ul id="Menu:be29cf73" class="Menu SubMenu"> |
21.1770116732713 |
0.000203 |
| [Debug] |
Castle.MonoRail.Framework.Services.DefaultCacheProvider Getting entry with key jslibraries.xml |
21.3596588393218 |
0.182647 |
| [Debug] |
Castle.MonoRail.Framework.Services.DefaultCacheProvider Getting entry with key jslibrariesDetails |
21.7859932617134 |
0.426334 |
| [Debug] |
Castle.MonoRail.Framework.Services.DefaultCacheProvider Getting entry with key quotelist |
22.09462990408 |
0.308637 |
| [Debug] |
Castle.MonoRail.Framework.Services.DefaultCacheProvider Storing entry quotelist with data System.Collections.Generic.List`1[StateTheater.Controllers.QuoteItem] |
22.3059746420285 |
0.211345 |
| [Debug] |
Castle.MonoRail.Framework.Services.DefaultCacheProvider Getting entry with key components\QuoteComponent\default.vm |
22.3535382290207 |
0.047564 |
| [Debug] |
Castle.MonoRail.Framework.Services.DefaultCacheProvider Storing entry components\QuoteComponent\default.vm with data Castle.MonoRail.Framework.Views.NVelocity.CustomTemplate |
22.3553490736951 |
0.001811 |
Control Tree |
| Control UniqueID |
Type |
Render Size Bytes (including children) |
ViewState Size Bytes (excluding children) |
ControlState Size Bytes (excluding children) |
Session State |
| Session Key |
Type |
Value |
| JSsegments |
Castle.MonoRail.ViewComponents.JSsegments |
Castle.MonoRail.ViewComponents.JSsegments |
Application State |
| Application Key |
Type |
Value |
| announcement |
System.String |
Hey, Hey, Hey, New Site! |
| Shows |
System.Collections.Generic.List`1[StateTheater.Models.ShowListing] |
System.Collections.Generic.List`1[StateTheater.Models.ShowListing] |
| date |
System.DateTime |
3/3/2009 9:49:16 PM |
Request Cookies Collection |
| Name |
Value |
Size |
Response Cookies Collection |
| Name |
Value |
Size |
Headers Collection |
| Name |
Value |
| Connection |
Keep-Alive |
| Accept |
image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, application/x-silverlight-2-b2, */* |
| Accept-Encoding |
gzip, deflate |
| Accept-Language |
en-us |
| Cookie |
ASP.NET_SessionId=dp5dx3nyyjlp4masoz1t2daj |
| Host |
localhost:64015 |
| User-Agent |
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; DigExt; GTB5; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; OfficeLiveConnector.1.3; OfficeLivePatch.0.0) |
| UA-CPU |
x86 |
Response Headers Collection |
| Name |
Value |
| X-AspNet-Version |
2.0.50727 |
| Cache-Control |
private |
| Content-Type |
text/html |
Form Collection |
| Name |
Value |
Querystring Collection |
| Name |
Value |
Server Variables |
| Name |
Value |
| ALL_HTTP |
HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, application/x-silverlight-2-b2, */* HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:en-us HTTP_COOKIE:ASP.NET_SessionId=dp5dx3nyyjlp4masoz1t2daj HTTP_HOST:localhost:64015 HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; DigExt; GTB5; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; OfficeLiveConnector.1.3; OfficeLivePatch.0.0) HTTP_UA_CPU:x86 |
| ALL_RAW |
Connection: Keep-Alive Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, application/x-silverlight-2-b2, */* Accept-Encoding: gzip, deflate Accept-Language: en-us Cookie: ASP.NET_SessionId=dp5dx3nyyjlp4masoz1t2daj Host: localhost:64015 User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; DigExt; GTB5; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; OfficeLiveConnector.1.3; OfficeLivePatch.0.0) UA-CPU: x86 |
| APPL_MD_PATH |
|
| APPL_PHYSICAL_PATH |
C:\Users\James\Documents\Visual Studio\Projects\StateTheaterCastleSln\web\ |
| AUTH_TYPE |
|
| AUTH_USER |
|
| AUTH_PASSWORD |
|
| LOGON_USER |
NANAK\James |
| REMOTE_USER |
|
| CERT_COOKIE |
|
| CERT_FLAGS |
|
| CERT_ISSUER |
|
| CERT_KEYSIZE |
|
| CERT_SECRETKEYSIZE |
|
| CERT_SERIALNUMBER |
|
| CERT_SERVER_ISSUER |
|
| CERT_SERVER_SUBJECT |
|
| CERT_SUBJECT |
|
| CONTENT_LENGTH |
0 |
| CONTENT_TYPE |
|
| GATEWAY_INTERFACE |
|
| HTTPS |
|
| HTTPS_KEYSIZE |
|
| HTTPS_SECRETKEYSIZE |
|
| HTTPS_SERVER_ISSUER |
|
| HTTPS_SERVER_SUBJECT |
|
| INSTANCE_ID |
|
| INSTANCE_META_PATH |
|
| LOCAL_ADDR |
127.0.0.1 |
| PATH_INFO |
/web/Show/Playing.rails |
| PATH_TRANSLATED |
C:\Users\James\Documents\Visual Studio\Projects\StateTheaterCastleSln\web\Show\Playing.rails |
| QUERY_STRING |
|
| REMOTE_ADDR |
127.0.0.1 |
| REMOTE_HOST |
127.0.0.1 |
| REMOTE_PORT |
|
| REQUEST_METHOD |
GET |
| SCRIPT_NAME |
/web/Show/Playing.rails |
| SERVER_NAME |
localhost |
| SERVER_PORT |
64015 |
| SERVER_PORT_SECURE |
0 |
| SERVER_PROTOCOL |
HTTP/1.1 |
| SERVER_SOFTWARE |
|
| URL |
/web/Show/Playing.rails |
| HTTP_CONNECTION |
Keep-Alive |
| HTTP_ACCEPT |
image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, application/x-silverlight-2-b2, */* |
| HTTP_ACCEPT_ENCODING |
gzip, deflate |
| HTTP_ACCEPT_LANGUAGE |
en-us |
| HTTP_COOKIE |
ASP.NET_SessionId=dp5dx3nyyjlp4masoz1t2daj |
| HTTP_HOST |
localhost:64015 |
| HTTP_USER_AGENT |
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; DigExt; GTB5; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; OfficeLiveConnector.1.3; OfficeLivePatch.0.0) |
| HTTP_UA_CPU |
x86 |
Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074
|