Solved

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

Posted on 2008-06-19
3
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

733 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