Click here to Skip to main content
15,886,802 members
Articles / Programming Languages / C#

AppLogger, a Simple Distributed Application Logger - Part 2 (Using MSMQ)

Rate me:
Please Sign up or sign in to vote.
4.71/5 (7 votes)
15 Jul 20044 min read 67.2K   1.3K   27  
Concluding article for simple distributed application logging
using System;
using AppLogger.BusinessFacade;

namespace AppLoggerTest
{
	/// <summary>
	/// Summary description for AppLoggerTest.
	/// </summary>
	public class AppLoggerTest
	{
        public AppLoggerTest()
        {
        }

        public void TestDebugLog()
        {
            AppLoggerHelper.LogDebug("This is debug log.");
        }

        public void TestInfoLog()
        {
            AppLoggerHelper.LogInfo("This is info log.");
        }

        public void TestWarningLog()
        {
            AppLoggerHelper.LogWarning("This is warning log.");
        }

        public void TestErrorLog()
        {
            AppLoggerHelper.LogError("This is error log.");
        }

        public void TestExceptionLog()
        {
            try
            {
                throw new ApplicationException("This is a simulated exception.");
            }
            catch (Exception ex)
            {
                AppLoggerHelper.LogException(ex);
            }
        }
        


        public static void Main()
        {
            AppLoggerTest objTester = new AppLoggerTest();
            try
            {
                objTester.TestDebugLog();
                objTester.TestInfoLog();
                objTester.TestWarningLog();
                objTester.TestErrorLog();
                objTester.TestExceptionLog();

                Console.WriteLine("Tests completed.");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Caught in Main: " + ex.ToString());
            }

        }
	}
}



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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Singapore Singapore
A software craftman, the roads I travelled include C++ to Java to C#, from Windows to Unix and now Microsoft .NET.
Full-time, I play the pragmatic roles of software designer, engineer and architect in the programming trenches.

Comments and Discussions