How can I output details of any Unhandled Exceptions that are encountered to my log file?

Posted on 2014-08-10
Last Modified: 2014-08-10
Hi Experts,

How can I output details of any Unhandled Exceptions that are encountered to my log file?
I assume this can be done via one block of code in my application.

Question by:LeighWardle
    LVL 74

    Accepted Solution

    Ordinarily it would depend on your application. It's often better to catch all of your exceptions in one layer so you can take appropriate actions. For example, our applications have a "user" layer and then a core layer. Our core handles catching all of the exceptions that occur so that we can log appropriately. If you don't have your project set up in an n-tier fashion, then you might try using the UnhandledExceptionEvent for this purpose.
    LVL 1

    Author Closing Comment

    Thanks, kaufmed.
    The link helped find a very useful example here:


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 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

    17 Experts available now in Live!

    Get 1:1 Help Now