Get Prolix at SourceForge.net. Fast, secure and Free Open Source software downloads

Prolix - AspNetMemoryAppender

log4net web interface

Description

Prolix, or AspNetMemoryAppender, is a log4net appender which sends logging information for your session to a separate tab in your browser.

What is this thing?

Have you ever wanted immediate access to logging information generated while your web page is loading, or been frustrated by the need for access to a remote filesystem or database in order to access logging information? Prolix aims to solve these problems by sending all logging information generated by your session to a separate browser tab.

All logs which are generated in the context of your ASP.NET session are sent to your logging tab using a push-style notification. This means that you only get logs for your session and you get them immediately. Wondering why the page hangs halfway through before redirecting to an error page? Your Prolix logs appear as soon as they're generated, regardless of the redirect.

The web interface is fairly simple; a tabular list of time, source (type name), logging level, and text data. The page will only retain 200 entries, automatically removing old entries. A simple settings interface allows the user to change the logging level, number of entries, or filter based on log type (session-specific or global).

Though full cross-browser testing hasn't really been performed, it works in the latest versions of Firefox, IE, and Safari.

Curious details

  • Compiles with .NET 2.0 under Mono and MS.NET
  • Works with recent releases of major browsers*
  • Requires that Javascript is enabled.

*(scrolling problem in Chrome)

Internals

The Prolix tab opens a connection to the web server which remains open indefinitely. This allows it to receive logging information as soon as it's generated using Comet-style push notifications. When new logs are generated, the library passes the data from the page request thread to logging request thread. It is then sent out to the browser as a javascript block which executes immediately.

Logs which occur outside of the context of a request are considered global, and sent to all Prolix recipients.

Since this works by passing information between threads on the same machine, it's not written to work within a load-balanced environment (unless you're using sticky-sessions or DNS-based load-balancing).

Setup

Setup involves a few changes in the web.config file and the inclusion of the Prolix interface page (this could be an HttpHandler, and may be someday).
<configuration>
  <configSections>
    <section name="log4net.Prolix" 
        type="log4net.Prolix.ProlixConfiguration, log4net.Prolix"/>
  <log4net.Prolix
    prototypePath=""
    scriptaculousSliderPath=""
    scriptaculousEffectsPath=""
    cometScriptPath=""
    cssPath=""
    scrollHandlePath=""
    scrollTopPath=""
    scrollBottomPath=""
    pagePath="~/__prolixListener.ashx"/>
  <system.web>
    <httpHandlers>
      <add verb="GET" path="ProlixResource.axd" 
            type="log4net.Prolix.ProlixResourceHandler, log4net.Prolix"/>
      <add verb="*" path="__prolixListener.ashx" 
            type="log4net.Prolix.AspNetCometHandler, log4net.Prolix"/>
    </httpHandlers>
The log4net configuration looks like this:
    <appender name="AspNetMemoryAppender" 
            type="log4net.Prolix.AspNetMemoryAppender, log4net.Prolix">
      <keyProviderClass 
            value="log4net.Prolix.CookieSessionKeyProvider, log4net.Prolix"/>
    </appender>
The keyProviderClass specifies how sessions are differentiated when determining which logs get sent where. The CookieSessionKeyProvider uses the ASP.NET session cookie to identify sessions.

Recent Releases

  • Initial, code-only (9-October-2009)

Contributors

Moxen Briddlebane (Admin) - blog