?
Solved

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

Posted on 2008-06-19
3
Medium Priority
?
181 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 2000 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

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

850 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