locked
How to handle exception using Microsoft enterprise library RRS feed

  • Question

  • User-1893100423 posted

    How to  log the exception or send out an email in website using Microsoft EnterPrise library Exception handling .


    Thursday, February 4, 2010 2:31 AM

All replies

  • User-1893100423 posted

    I Used below method : But unable to  send  mail..

    private static EmailTraceListener GetEmailTraceListener(TextFormatter formatter)
            {
                // Log messages to a log file.
                // Use the formatter passed
                // as well as the header and footer
                // specified.


                EmailTraceListener mailListener =
                    new EmailTraceListener("abc@snlcorporate.com", "abc@gmail.com", "Admin", "<<ApplicationName>>", "smtp.gmail.com", xyz, formatter);
                return mailListener;
            }



    Thursday, February 4, 2010 8:02 AM
  • User619554136 posted

    I am also very new to Logging block. according to my knowledge we can configure all the email settings in app.config/web.config as a Trace Lister. So no need to write any code related to email settings in c#. Once you use Logger.Write("....."). your string in write method will be redirected to the Trace listener you configured in .config file. This trace listener could be email, database, windows event log...etc. Unfortunatly I could not get good material in web. I would also wait for reply for someone to get clear picture on how to configure all these things.

    Sunday, February 7, 2010 3:09 PM
  • User-1893100423 posted

    for log Entry in database follow  below post steps :

    http://entlib.codeplex.com/Thread/View.aspx?ThreadId=83105


    First of all you must execute the .sql file that will create the Logging database for you. It is available in the <Drive Letter>\EntLib41Src\Blocks\Logging\Src\DatabaseTraceListener\Scripts\LoggingDatabase.sql . Then you can now (1)add a Database trace listener in the LAB. (2) Configure a connection string in your DAAB section which points to the database that was created running the said script. (3) Configure the DatabaseInstance property of the database trace listener and point it to the created connection string in step #2. (4) Add a trace listener reference to the desired category and point its reference to the database trace listener.

    Source: Valiant Dudan
    Global Technology and Solutions
    Avanade, Inc.

    Monday, February 8, 2010 12:53 AM
  • User619554136 posted

    Hi Sandeep, His/My question was related to Email sending using Logging Listers.

    Tuesday, February 9, 2010 2:42 AM