Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 11th, 2007, 10:04 PM
Authorized User
 
Join Date: Dec 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default set the Exception Source property before writing t

Hi,

   How to set the Exception Source property before writing to the event log?

I have to add a event log for a function,but i when i do
AddEventLog( "BillingDetails TextFile Written" ); i get the following error..............

The error i get in the eventlog is :

                 "10:00 AM:Sub Service: Exception Source property was not set before writing to the event log. "

what has to be done???if somebody knows the answer please share with me..............

Thanks,
Karthik
__________________
Karthik
[Nothing is impossible]
 
Old January 11th, 2007, 11:36 PM
Authorized User
 
Join Date: Feb 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to karthiklsimha
Default

Hi,

If you want to write log into system event log, then try
Code:
System.Diagnostics.EventLog.WriteEntry
Regards,
Karthik Simha
 
Old January 12th, 2007, 01:17 AM
Authorized User
 
Join Date: Dec 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Simha,

     I am getiing the same error...............with ur code...

Thanks,
Karhtik
 
Old January 12th, 2007, 01:56 AM
Authorized User
 
Join Date: Feb 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to karthiklsimha
Default

Hi Karthik,

Create a new source where the log has to be written.

        If Not System.Diagnostics.EventLog.SourceExists("ABC") Then
            System.Diagnostics.EventLog.CreateEventSource("ABC ", "TestLog")
        End If
        System.Diagnostics.EventLog.WriteEntry("TestLog", "Test Message")

Hope this will work. You can see the log written using the tool EventViewer from the location Control Panel\Administrative Tools\EventViewer.


Regards,
Karthik Simha





Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Data Source class property Colonel Angus ASP.NET 2.0 Professional 5 March 17th, 2008 03:21 PM
Get Set Property value being lost asn187 ASP.NET 2.0 Professional 1 April 19th, 2007 03:09 PM
Set accountExpires property r_ganesh76 C# 0 August 9th, 2006 01:16 AM
Security exception comes when writing to event log s_vermani BOOK: Beginning ASP.NET 1.0 4 October 21st, 2004 09:17 AM
Urgent: Stack Trace Property of SQLCE Exception rcmetta BOOK: Professional Crystal Reports for VS.NET 1 May 11th, 2004 12:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.