Skip to content

Commit

Permalink
Fix Logging Error
Browse files Browse the repository at this point in the history
  • Loading branch information
Bottswana committed Nov 24, 2015
1 parent e71ba60 commit e4844c5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
/.vs/RemoteDesktopService/v14/*.suo
*.user

bin

obj

.vs
*.suo
16 changes: 10 additions & 6 deletions RemoteDesktopService/RemoteAppDesktopService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ public partial class RemoteAppDesktopService : ServiceBase
{
#region Service Template
public RegistryMonitor Thread;

public RemoteAppDesktopService()
{
InitializeComponent();

_GetEventLog();

Thread = new RegistryMonitor(this, this.ApplicationEventLog);
}

Expand All @@ -38,13 +37,18 @@ protected override void OnStop()
#region Service Methods
protected void _GetEventLog()
{
if( !EventLog.SourceExists("DesktopAppMonitor") )
try
{
EventLog.CreateEventSource("RemoteApp Desktop Monitor", "Application");
if( !EventLog.SourceExists("RemoteApp Desktop Monitor") )
{
EventLog.CreateEventSource("RemoteApp Desktop Monitor", "Application");
}

this.ApplicationEventLog.Source = "RemoteApp Desktop Monitor";
this.ApplicationEventLog.Log = "Application";
}
catch( Exception ) {}

this.ApplicationEventLog.Source = "RemoteApp Desktop Monitor";
this.ApplicationEventLog.Log = "Application";
}
#endregion Service Methods
}
Expand Down

0 comments on commit e4844c5

Please sign in to comment.