Click here to Skip to main content
15,885,546 members
Home / Discussions / C#
   

C#

 
QuestionRemoting in dot net Pin
ilango gandhi7-May-08 5:07
ilango gandhi7-May-08 5:07 
AnswerRe: Remoting in dot net Pin
led mike7-May-08 5:14
led mike7-May-08 5:14 
AnswerRe: Remoting in dot net Pin
Cranky7-May-08 5:33
Cranky7-May-08 5:33 
AnswerRe: Remoting in dot net Pin
Abhijit Jana7-May-08 5:55
professionalAbhijit Jana7-May-08 5:55 
AnswerRe: Remoting in dot net Pin
leckey7-May-08 6:41
leckey7-May-08 6:41 
QuestionText Ticker Pin
KBou7-May-08 4:59
KBou7-May-08 4:59 
AnswerRe: Text Ticker Pin
Christian Graus7-May-08 12:01
protectorChristian Graus7-May-08 12:01 
QuestionA question on having multiple source log to an eventlog Pin
LongRange.Shooter7-May-08 4:20
LongRange.Shooter7-May-08 4:20 
I have a service that launches multiple threads. Each thread has a unique purpose and thus they are unique sources. I have a successfully created log file named OneSource and I want all of the sources logging events to that log file.

Currently I have each thread initializing and accessing the EventLog with their own instances, the service itself does not do any logging. My first thread that I start successfully initialized and logs to the file but subsequent ones do not. Here is my eventlog initialization logic (some names were changed to protect the innocent Smile | :) :

C#
#region Eventlog initialization

bool creationNeeded = false;

if ( !EventLog.SourceExists( "someSource" ) )
    creationNeeded = true;
else if ( !EventLog.LogNameFromSourceName( "someSource", "." ).Equals( "OneSource" ) )
{
    creationNeeded = true;    // management changed the log name again!
    EventLog.DeleteEventSource( "someSource" );
}
if ( creationNeeded )
{
    EventLog.CreateEventSource( "someSource", "OneSource" );
}

events = new System.Diagnostics.EventLog( "OneSource", ".", "someSource" );
events.WriteEntry( "someSource: Event log successfully started.", EventLogEntryType.Information );

#endregion


FYI: We had management constantly changing their minds on the log file to use so we had to add code to make sure that the old log was deleted before we used the new logfile name and source.

I see the initialization message from sourceOne, but not from sourceTwo or sourceThree. Nor do I see any logged messages from anything but sourceOne. Also...I see Information logged entries from sourceOne, but I never see anything logged where I use an AuditSuccess state for the log event.

Any guidance would be appreciated.
AnswerRe: A question on having multiple source log to an eventlog Pin
led mike7-May-08 4:48
led mike7-May-08 4:48 
GeneralRe: A question on having multiple source log to an eventlog Pin
LongRange.Shooter7-May-08 4:56
LongRange.Shooter7-May-08 4:56 
GeneralRe: A question on having multiple source log to an eventlog Pin
led mike7-May-08 4:59
led mike7-May-08 4:59 
GeneralRe: A question on having multiple source log to an eventlog Pin
Ashfield7-May-08 5:21
Ashfield7-May-08 5:21 
GeneralRe: A question on having multiple source log to an eventlog Pin
LongRange.Shooter7-May-08 7:18
LongRange.Shooter7-May-08 7:18 
GeneralRe: A question on having multiple source log to an eventlog Pin
Ashfield7-May-08 23:28
Ashfield7-May-08 23:28 
GeneralRe: A question on having multiple source log to an eventlog Pin
leckey7-May-08 6:44
leckey7-May-08 6:44 
GeneralRe: A question on having multiple source log to an eventlog Pin
LongRange.Shooter7-May-08 7:35
LongRange.Shooter7-May-08 7:35 
AnswerRe: A question on having multiple source log to an eventlog Pin
Dave Kreskowiak7-May-08 7:36
mveDave Kreskowiak7-May-08 7:36 
GeneralRe: A question on having multiple source log to an eventlog Pin
LongRange.Shooter7-May-08 8:20
LongRange.Shooter7-May-08 8:20 
GeneralRe: A question on having multiple source log to an eventlog Pin
Dave Kreskowiak7-May-08 8:28
mveDave Kreskowiak7-May-08 8:28 
QuestionHaving trouble calling legacy 'c' dll Pin
LouMattera7-May-08 4:02
LouMattera7-May-08 4:02 
AnswerRe: Having trouble calling legacy 'c' dll Pin
led mike7-May-08 4:42
led mike7-May-08 4:42 
GeneralRe: Having trouble calling legacy 'c' dll Pin
LouMattera7-May-08 5:07
LouMattera7-May-08 5:07 
GeneralRe: Having trouble calling legacy 'c' dll Pin
led mike7-May-08 5:12
led mike7-May-08 5:12 
GeneralRe: Having trouble calling legacy 'c' dll Pin
LouMattera7-May-08 5:26
LouMattera7-May-08 5:26 
QuestionHow to get a datarow from a datable in C#? Pin
salon7-May-08 3:41
salon7-May-08 3:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.