Click here to Skip to main content
15,896,912 members
Articles / Web Development / ASP.NET

Exception Handling & Logging Application Block: Enterprise Library 1.0

Rate me:
Please Sign up or sign in to vote.
3.66/5 (34 votes)
1 May 2005CPOL4 min read 322.3K   2.5K   78  
This article illustrates how to log your Exception into trace.log file using Enterprise Library of .NET Framework.
<VisualStudioProject>
    <CSHARP
        ProjectType = "Web"
        ProductVersion = "7.10.3077"
        SchemaVersion = "2.0"
        ProjectGuid = "{669A060D-339E-4DD0-ADA6-516964952F69}"
    >
        <Build>
            <Settings
                ApplicationIcon = ""
                AssemblyKeyContainerName = ""
                AssemblyName = "ExceptionConfiguration block"
                AssemblyOriginatorKeyFile = ""
                DefaultClientScript = "JScript"
                DefaultHTMLPageLayout = "Grid"
                DefaultTargetSchema = "IE50"
                DelaySign = "false"
                OutputType = "Library"
                PreBuildEvent = ""
                PostBuildEvent = ""
                RootNamespace = "ExceptionConfiguration_block"
                RunPostBuildEvent = "OnBuildSuccess"
                StartupObject = ""
            >
                <Config
                    Name = "Debug"
                    AllowUnsafeBlocks = "false"
                    BaseAddress = "285212672"
                    CheckForOverflowUnderflow = "false"
                    ConfigurationOverrideFile = ""
                    DefineConstants = "DEBUG;TRACE"
                    DocumentationFile = ""
                    DebugSymbols = "true"
                    FileAlignment = "4096"
                    IncrementalBuild = "false"
                    NoStdLib = "false"
                    NoWarn = ""
                    Optimize = "false"
                    OutputPath = "bin\"
                    RegisterForComInterop = "false"
                    RemoveIntegerChecks = "false"
                    TreatWarningsAsErrors = "false"
                    WarningLevel = "4"
                />
                <Config
                    Name = "Release"
                    AllowUnsafeBlocks = "false"
                    BaseAddress = "285212672"
                    CheckForOverflowUnderflow = "false"
                    ConfigurationOverrideFile = ""
                    DefineConstants = "TRACE"
                    DocumentationFile = ""
                    DebugSymbols = "false"
                    FileAlignment = "4096"
                    IncrementalBuild = "false"
                    NoStdLib = "false"
                    NoWarn = ""
                    Optimize = "true"
                    OutputPath = "bin\"
                    RegisterForComInterop = "false"
                    RemoveIntegerChecks = "false"
                    TreatWarningsAsErrors = "false"
                    WarningLevel = "4"
                />
            </Settings>
            <References>
                <Reference
                    Name = "System"
                    AssemblyName = "System"
                    HintPath = "..\..\..\WINNT\Microsoft.NET\Framework\v1.1.4322\System.dll"
                />
                <Reference
                    Name = "System.Drawing"
                    AssemblyName = "System.Drawing"
                    HintPath = "..\..\..\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
                />
                <Reference
                    Name = "System.Data"
                    AssemblyName = "System.Data"
                    HintPath = "..\..\..\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
                />
                <Reference
                    Name = "System.Web"
                    AssemblyName = "System.Web"
                    HintPath = "..\..\..\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Web.dll"
                />
                <Reference
                    Name = "System.XML"
                    AssemblyName = "System.Xml"
                    HintPath = "..\..\..\WINNT\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
                />
                <Reference
                    Name = "Microsoft.Practices.EnterpriseLibrary.ExceptionHandling"
                    AssemblyName = "Microsoft.Practices.EnterpriseLibrary.ExceptionHandling"
                    HintPath = "..\..\..\Program Files\Microsoft Enterprise Library\bin\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll"
                />
                <Reference
                    Name = "Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging"
                    AssemblyName = "Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging"
                    HintPath = "..\..\..\Program Files\Microsoft Enterprise Library\bin\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll"
                />
            </References>
        </Build>
        <Files>
            <Include>
                <File
                    RelPath = "AssemblyInfo.cs"
                    BuildAction = "Compile"
                />
                <File
                    RelPath = "ExceptionApplicationBlock.aspx"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "ExceptionApplicationBlock.aspx.cs"
                    DependentUpon = "ExceptionApplicationBlock.aspx"
                    SubType = "ASPXCodeBehind"
                    BuildAction = "Compile"
                />
                <File
                    RelPath = "ExceptionApplicationBlock.aspx.resx"
                    DependentUpon = "ExceptionApplicationBlock.aspx.cs"
                    BuildAction = "EmbeddedResource"
                />
                <File
                    RelPath = "Global.asax"
                    SubType = "Component"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "Global.asax.cs"
                    DependentUpon = "Global.asax"
                    SubType = "Code"
                    BuildAction = "Compile"
                />
                <File
                    RelPath = "Global.asax.resx"
                    DependentUpon = "Global.asax.cs"
                    BuildAction = "EmbeddedResource"
                />
                <File
                    RelPath = "Web.config"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "bin\ExceptionConfiguration block.dll"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "bin\ExceptionConfiguration block.pdb"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "bin\Microsoft.Practices.EnterpriseLibrary.Common.dll"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "bin\Microsoft.Practices.EnterpriseLibrary.Configuration.dll"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "bin\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "bin\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll"
                    BuildAction = "Content"
                />
                <File
                    RelPath = "bin\Microsoft.Practices.EnterpriseLibrary.Logging.dll"
                    BuildAction = "Content"
                />
            </Include>
        </Files>
    </CSHARP>
</VisualStudioProject>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
Australia Australia
Whatsup-->Exploring--> MVC/HTML5/Javascript & Virtualization.......!
www.santoshpoojari.blogspot.com

Comments and Discussions