Solved

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

Posted on 2008-06-19
3
164 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
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.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

828 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