Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > How Do You Force InstallUtil.exe to STOP associating your eventlog source to the Application log?
 

How Do You Force InstallUtil.exe to STOP associating your eventlog source to the Application log?

How Do You Force InstallUtil.exe to STOP associating your eventlog source to the Application log?

I have written a Windows Service in C# (.NET 2.0). I have created a custom log via EventLogInstaller and EventSourceCreationData. However, when I run the InstallUtil.exe to install my windows service, I notice it keeps associating my event source with the Application log under the eventviewer instead of my custom log.

Have you ran into this problem before?

Please advise.

Thank you,

Leon

LeonS  Monday, April 16, 2007 4:13 AM

Again, I answered my own question. :-)

It is working now. It appears to be simply a .NET 1.1 or earlier issue. My .NET 2.0 apps writes to the custom log without problem. And I set the AutoLog attribute to false for the process installer. The InstallUtil.exe is still creating the soource in application log. But I just change my source name so it's slightly different from my application name.

Anyway, the key is to make sure you are using .NET 2.0 or later with the EventSourceCreationData class. You must specify the category/message file info.

-Leon S

LeonS  Monday, April 16, 2007 4:55 AM

Again, I answered my own question. :-)

It is working now. It appears to be simply a .NET 1.1 or earlier issue. My .NET 2.0 apps writes to the custom log without problem. And I set the AutoLog attribute to false for the process installer. The InstallUtil.exe is still creating the soource in application log. But I just change my source name so it's slightly different from my application name.

Anyway, the key is to make sure you are using .NET 2.0 or later with the EventSourceCreationData class. You must specify the category/message file info.

-Leon S

LeonS  Monday, April 16, 2007 4:55 AM

If anyone can provide insight as to how to stop this association, I'd still like to know... Thanks.

I'm using C# and .Net 2.0 - I'm logging to a custom log and I see no need to add an Event Source that will never be used.

J

Jerry Camel  Wednesday, January 23, 2008 7:50 AM
rlrcstr wrote:

If anyone can provide insight as to how to stop this association, I'd still like to know... Thanks.

I'm using C# and .Net 2.0 - I'm logging to a custom log and I see no need to add an Event Source that will never be used.

J

Did my earlier post not work for you? It's not much more programming. And it will stop the association as described.

http://msdn2.microsoft.com/en-us/library/49dwckkz(vs.71).aspx

Article on similar problems:

http://www.thescripts.com/forum/thread245902.html

Creating a resource file

http://msdn2.microsoft.com/en-us/library/system.diagnostics.eventloginstaller.categoryresourcefile.aspx

http://msdn2.microsoft.com/en-us/library/aa385633.aspx

A snippet of my code:

public class ServiceLogger

{

private EventLog m_eventlog = null;

private String m_sourceApplicationName = null;

private String m_logClassName = "Leon";

private String m_machineName = null;

private System.Diagnostics.EventSourceCreationData eventCreationData;

public ServiceLogger(String sourceAppName, String logClassName, String machineName)

{

//

// TODO: Simple constructor. Needs exception handling

//

m_sourceApplicationName = sourceAppName.Trim();

if(logClassName != null && logClassName.Trim().Length > 0)

m_logClassName = logClassName.Trim();

if(machineName != null && machineName.Trim().Length > 0)

m_machineName = machineName.Trim();

else

m_machineName = Environment.MachineName;

eventCreationData = new System.Diagnostics.EventSourceCreationData(m_sourceApplicationName,m_logClassName);

eventCreationData.CategoryCount = 9;

eventCreationData.CategoryResourceFile = "E:\\My Documents\\SharpDevelop Projects\\MyWindowsService\\MyWindowsService.dll";

eventCreationData.MessageResourceFile = "E:\\My Documents\\SharpDevelop Projects\\MyWindowsService\\MyWindowsService.dll";

}

LeonS  Wednesday, January 23, 2008 8:18 AM

I'm not having an issue creating the custom log. I just don't want the installer to create the Application Log source. I'm not sure what earlier post you are referring to. But I didn't see anything with code. I just saw a note where you said that you found a way around it, but that the Application Log association was still ocurring.

J

Jerry Camel  Wednesday, January 23, 2008 8:26 AM

Gotcha. Sorry, I don't think I was able to stop the creating of that log. However, it can be ignored if using a custom log and setting the autolog property as mentioned earlier. Hope that helps.

LeonS  Wednesday, January 23, 2008 9:18 AM

I have exactly the same problem. I've written a service using VS.NET 2008 C# and I'm using MSBuild to make the installer and InstallUtil to install the service for testing. At the end of the InstallUtil installation phase I see, "Creating EventLog source<service name>in log Application...". I don't want InstallUtil to register an event source for my service, as my service creates its own event log and registers itself as an event source using a different name than its service name.

All of my service's events are correctly written to my custom event log, but the Application log also gets start and stop messages originating from my service. This causes confusion with special log monitoring software that expects a program to have only one registered event source. I would sure like to know how to keep InstallUtil from automatically registering my service's name as an event source with the Application log. Thank goodness InstallUtil isn't used by MSBuild, or this problem would be occurring out in the field.

jdmurray  Thursday, June 26, 2008 11:35 PM
I Have exactly the same problem and would like to disable InstallUtil EventSource automatic registration.
Brice Cassagnabère  Monday, May 25, 2009 10:04 AM
Me too, i really wonder why MSFT always thinks they know what people want. Give me a command arg to stop that silly behaviour. Why would I make my custom event log in the first place if still some ____ ends up in the application log. Waisting time on such stuff ,grrrr
nojetlag  Monday, August 10, 2009 6:12 PM

You can use google to search for other answers

Custom Search

More Threads

• Web Publishing with multiple connection strings
• Deployment of Exe in C#.NET
• Uninstall uses DefaultLocation + some more questions....
• Create a Name for CAB file
• Application installs twice
• ClickOnce update - older versions remain on server?
• Converting VDPROJ to WIX
• BadImageFormatException
• Publisher info in ClickOnce manifest
• [VS Setup project] editing properties ?