Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

ASP.NET Logging

Hey, i'm new to, and having some difficulty debuging some of the Classes i've compiled as DLLs.  Does system.out print to a log file somewhere?  Is there a way to print out debug or errors to a log file?  Any info on this would be appreciated. 

Monday, January 26, 2004

Nothing built in. You have to do it yourself.

From anything service related (including ASP.NET), I prefer to log to the Event Log. Log files are very... Unix. :-p

Brad Wilson (
Monday, January 26, 2004

Maybe I'm misunderstanding the question but have you tried Trace? 

Set the Trace attribute on the Page element to true:
  <%@ Page Trace="true" %>

This prints a bunch of trace information at the bottom of the page.  You can add your own output to the trace by calling methods such as Trace.Write("In MyFunction", "Hello from MyFunction"). 

If you don't want to see the trace printed to the bottom of the page, do a search for info on trace.axd.  This will let you view the trace information on a separate page. 

This is only effective during development since you don't want end users to see the trace information.  If you're looking to log something in production, go with what Brad said -- EventLog or a file (the appropriate permissions will need to be set).  Also, Microsoft has a Logging Application Block though I've never used it:

Tuesday, January 27, 2004

there's also log4net, though i've never used it.

Thursday, January 29, 2004

This is an old thread, but in case anybody stumbles upon it...

I find the "response.write()" statement very useful. I often write out test information as HTML comments. You can then use the View Source command to see them.

James Shields
Tuesday, April 6, 2004

*  Recent Topics

*  Fog Creek Home