.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Logging to event log

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :Sql Server
hi, Looks like the xp_logevent or the Raiseerror will log to default application event log and doesn't support to log to custom event log. Also,we can't specify event ID and SQL uses a constant ID for logging all system or custom messages using above procedures. Is there a way we can implement logging to a custom event log and also with specif event id in SQL Server so that I can configure event log monitor using SCOM for some specific events?  Trinity

View Complete Post

More Related Resource Links

Security Briefs: Improve Manageability through Event Logging


When something goes wrong, a manageable application will tell the administrator how to fix the problem. The Windows Event Log can provide the necessary information.

Keith Brown

MSDN Magazine April 2007

Debugging Tool: Build a Logging and Event Viewing Library to Help Debug Your .NET Framework-based Ap


Building a basic, reusable application framework can make development quicker and easier. This allows you to focus more on the problems at hand and less on the repetitive tasks involved in building any application. In this article, the author presents a framework that provides facilities to access the registry and an extensible framework for logging messages to a console window or the Event Viewer. This reusable framework can be included as a library in your projects, allowing you to display an enhanced, color-coded message log and dynamically change logging levels.

Daryn Kiely

MSDN Magazine May 2003

Radio Button Event

Here I have explained the events of radio button with javascript.
Let me explain the scenarion first,
We are having two radio button say radioobtn1 and radiobtn2. If I click on the button 1 then I need to show one DIVor FORM. same as when I click on radiobtn 2. I have given the code for the above scenarion.

how to impose javascript event processing?


If I have some form control like textbox and I want the event handler to be located in the html instead of at the server side, how to do that? Of course I can copy paste javascript code in the aspx file. But is it possible to do that using some object oriented approach (ie programmatically in the code behind)?


Dropdown Event (Template Field)



I have grid view control that includes a dropdown control in a template field.

I wish to execute some code when the value is changed in the dropdown list.  Can't figure out how to capture this event though?

Any suggestions?

Event ID 1011 - DefaultAppPool World Wid Web Pub. Serv. fatal communication error

We have a Windows 2003 server running IIS6 1.1 Framework. We have also installed a DNS and Active Directory in the same machine.

We're randomly getting the error you can see below. Sometimes it causes the recycling of process w3wp.exe (which on my understanding represents the application pool worker processd) and other times results on this process hanging and not responding to any request. To do iisrest temporarly solves the problem.

We were pointed to a possible permissions problem between the user we were runnig the DefaultAppPool with and registry entries used by the iis. We noticed the default predifined user we used, Network Service, wasn't found in the Active Directory, so we changed it by the default configurable user, IWAM_MACHINE_NAME, which is under the IIS_WPG Active Directory Grupo, which, in theory has the correct permissions to run the application pool.

Well, none of this worked and we are still getting this error.

This is driving us crazy and think the problem might have to do with having the Domain Controller/Active Directory and the IIS6 running on the same machine. We'll try now uninstalling this DC pointing to another one to see what happens.

Any help would be appreciated.

Thanks in advance,


Event Type: Warning

Event not raised while parsing xml file



In Visual Studio 2010 ASP.NET 4.0

I want to write a procedure to validate a xml file with a xsd. I found some examples on the web but the one i chose does not work as attended. The example uses XmlReader with a XmlReaderSettings and a ValidationEventHandler.

Here is the code

Protected Sub VerifyDes(ByVal filename As String)

        Dim xslDes As XmlReaderSettings = New XmlReaderSettings()
        xslDes.Schemas.Add("", "http://www.mysite.com/xsd/ValidData.xml")
        xslDes.ValidationType = ValidationType.Schema
        xslDes.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings

        AddHandler xslDes.ValidationEventHandler, AddressOf xslDesValidationEventHandler

        Dim des As XmlReader = XmlReader.Create(filename, xslDes)

        While (des.Read())

        End While

    End Sub

    Protected Sub xslDesValidationEventHandler(ByVal sender As Object, ByVal e As ValidationEventArgs)

        'some code here
    End Sub

I tested this procedure with a xml file which was well formed but contained some elements which were not conform to the xsd.

No event or error occured. It said the file was valid.

Then i tested with a badly formed file. A XmlException was raised but nothing happened with the ValidationEventHandler.

It seems lik

How to set up microsoft application blocks 4.0 to talk to event viewer


I need to set up the microsoft application blocks 4.0 on the server and connect it to my web project.  I need to set it up so that all the errors are logged in the event viewer.  So far I have found out how to set up a flat file listener and send the error to a log file but, not to the event viewer.  Any suggestions would be helpful.

    Using the ConsoleTraceListener with the Enterprise Library 3.1 Logging Block


    I'm new to using the Logging application block.  I think I have a pretty good handle on how things work.  However, I'm running into a problem.  I'm using the RollingFlatFileListener and I have formatted the logging template to be more like the logging we are replacing.  However, in our console apps when the ConsoleTraceListener is added it still logs it out in the default text template format.  Is there any way to get around this?  Currently it looks like I will have to create a new TraceListener called FormattedConsoleListener that allows a text formatter to be associated with it.  Is this the only way?

    Data Truncation issue with Enterprise Library Logging WriteLog stored Proc


    Hi ,

    I'm using Enterprise Library Logging  feature for logging. The issue i am facing is when the Logging message is too large(more than 65534 chars) ,complete data  is not logged in the Formatted Mesage column which is  of data Type nText .

    I am able insert complete data if i try inserting from Sql insert Query from sql management studio. Do i need to add any attributes to data base listener or do i need to change the sp.

     Is there any way to increase the WriteLog stored proc param size in EnterpriseLibrary.Logging config file ? . Please let me know.


    Thanks In Advance.

    Logging to database is not working



    Am using Enterprise library 4.0 for logging exceptions to SQL server database. The code is working fine if I run my asp.net application from the Visual studio IDE.However if I publish the site and host it on IIS, then my application is not logging the errors to database.Here is the page load event of my application.Kindly help me in finding out the error.

    Thanks in advance


     protected void Page_Load(object sender, EventArgs e)
                    //If exception occurs due to unauthorized access
                    if ((Request.QueryString["Unauthorized"] != null) && (Request.QueryString["Unauthorized"].Equals("Y")))
                            lblErrorMessage.Text = "You are not authorized to view this page";
                            //Get the user and machine names                       
                            string strUserName = User.Identity.Name;
                            string strMachineName = System.Environment.MachineName;
                            //Raise Error
                            throw new System.UnauthorizedAccessException("Unauthorized access--User Name:" + strUserName + "--Machine Name:" + 

    Composite control: How to bubble a textbox's TextChanged event?


    I've created a composite control that contains several controls, including a textbox. I'm trying to expose the TextChanged event of the textbox as an event on the composite control. I understand that events can be bubbled up the control hierarchy and handled at a higher level, which I've attempted to do, but I can't get the bubbled event to fire. When I drop the control on an aspx I can see the TextChanged event, I can subscribe to the event, but nothing ever happens. Any suggestions? Here is what I think is the relevant code:

    // My event
    private static readonly object EventTextChanged = new object();

    //Handle the bubbled event
    EventHandler textChangedHandler = (EventHandler)Events[EventTextChanged];
    protected override bool OnBubbleEvent(object source, EventArgs e) 
        bool handled = false;

    Reporting services in 2008 r2 how to get a report in a print button click event in my c#.net page


    how to  get a report in my c#.net page button lick event also steps to call a report from asp.net to reporting services


    Thanks in advance

    Creating Event Handler in Code behind


    Hi, so I have a control that is created in the code behind and generates fine but I can't figure out how to create an event handler for it.  I've found plenty of examples for it in C sharp, but none of them seem to apply to VB.  What I want to do is essentially this:

    myDropDownList.SelectedIndexChanged = "Event to do here"

    but it doesn't seem to work for me.

    Any suggestions are appreciated.

    Subscribing to .Net event from COM



    Can somebody tell me how to subscribe to .net event from the COM through interoperability?

    namespace EventSource
        public interface IBugEvents
            void Hungry();
            void Found(string item);
        public class Bug
            public delegate void HungryEventHandler();
            public delegate void FoundEventHandler(string item);
            public event HungryEventHandler Hungry;
            public event FoundEventHandler Found;

    Can somebody tell me how to Subscribe to the Hungry and Found events from the COM?If possible help me with COM Code.

    Cloud Diagnostics: Take Control of Logging and Tracing in Windows Azure


    It's difficult to troubleshoot any application without a trail of clues to follow, and cloud apps are no different. We look at how logging and tracing are enabled for Windows Azure, and how you can use Windows PowerShell to manage diagnostics for a running service.

    Mike Kelly

    MSDN Magazine June 2010

    Event Tracing For Windows: Core Instrumentation Events in Windows 7, Part 2


    In Part 2, the authors cover core OS Event Tracing for Windows (ETW) events as well as present simple scripts to demonstrate a few basic accounting techniques on some of the OS events introduced.

    Alex Bendetov, Insung Park

    MSDN Magazine October 2009

    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend