Solved

logging application for a web application developed in ASP.net 3.5

Posted on 2008-06-19
3
159 Views
Last Modified: 2013-11-07
Hello
I am developing a web application Social networking site using ASp.net 3.5 and VS 2008
I am looking for a logging application tool and have come across two of them

1.> http://logging.apache.org/log4net/
2.> http://www.davidhayden.com/blog/dave/archive/2006/02/19/2806.aspx

if you have any better, please let me know.

I am looking for a tool which isnt
a.> heavy and doesnt make the application run slowly
b.> i should be able to compile with the log messages disabled i.e in visual studio I should have the option  to compile with the logging application disabled

thanks
0
Comment
Question by:jbajaj
  • 2
3 Comments
 
LVL 37

Expert Comment

by:samtran0331
ID: 21821602
Both are probably "heavier" than you need.
Both are basically wrappers for things you can do yourself, so in my opinion, both are going to add overhead.  
Using these tools will give you a robust logging system, but if you don't need all the features and  if your goal is to be as lightweight as possible, I would suggest you use neither.

If you look in the second example, the core of what you need to capture an error is:


    void Application_Error(object sender, EventArgs e)
    {
        Exception ex = Server.GetLastError().GetBaseException();
       
        string message = ex.Message +
                        "\nSOURCE: " + ex.Source +
                        "\nFORM: " + Request.Form.ToString() +
                        "\nQUERYSTRING: " +                            Request.QueryString.ToString() +
                        "\nTARGETSITE: " + ex.TargetSite +
                        "\nSTACKTRACE: " + ex.StackTrace;
        Logger.Write(message);
    }


The only thing that including the enterprise library does is give you the:
        Logger.Write(message);


And you can create a simple function to do something with the message yourself (insert it into a db, email it to a support email address, etc.)

as to the second part of being able to enable/disable it.
I would simply put a key in the web.config that would be either "true/false" which would either log your errors or not.
0
 

Author Comment

by:jbajaj
ID: 21825674
Thanks so much Samtran

However could there be a way I could add this tool, but not compile it
0
 
LVL 37

Accepted Solution

by:
samtran0331 earned 500 total points
ID: 21825896
I haven't used log4net before, but looking at the site; I would guess that it would be highly recommended to compile it with the application because it is integrated with the applicaiton itself.
I have used the MS-App blocks before and I know this to be the case.

I doubt either would slow down the performance of your application.
It would only increase the build time in Visual Studio (which would be minor) and increasee the size of your final compiled dll(s) for the app.  But it wouldn't mean a performance decrease.

Even if you choose to include one of the tools you listed; I would still recommend you put a key in web.config to enable/disable whether the logging is active or not.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now