Skip to content

Commit e4844c5

Browse files
committed
Fix Logging Error
1 parent e71ba60 commit e4844c5

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
/.vs/RemoteDesktopService/v14/*.suo
1+
*.user
2+
3+
bin
4+
5+
obj
6+
7+
.vs
8+
*.suo

RemoteDesktopService/RemoteAppDesktopService.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ public partial class RemoteAppDesktopService : ServiceBase
1010
{
1111
#region Service Template
1212
public RegistryMonitor Thread;
13-
1413
public RemoteAppDesktopService()
1514
{
1615
InitializeComponent();
17-
1816
_GetEventLog();
17+
1918
Thread = new RegistryMonitor(this, this.ApplicationEventLog);
2019
}
2120

@@ -38,13 +37,18 @@ protected override void OnStop()
3837
#region Service Methods
3938
protected void _GetEventLog()
4039
{
41-
if( !EventLog.SourceExists("DesktopAppMonitor") )
40+
try
4241
{
43-
EventLog.CreateEventSource("RemoteApp Desktop Monitor", "Application");
42+
if( !EventLog.SourceExists("RemoteApp Desktop Monitor") )
43+
{
44+
EventLog.CreateEventSource("RemoteApp Desktop Monitor", "Application");
45+
}
46+
47+
this.ApplicationEventLog.Source = "RemoteApp Desktop Monitor";
48+
this.ApplicationEventLog.Log = "Application";
4449
}
50+
catch( Exception ) {}
4551

46-
this.ApplicationEventLog.Source = "RemoteApp Desktop Monitor";
47-
this.ApplicationEventLog.Log = "Application";
4852
}
4953
#endregion Service Methods
5054
}

0 commit comments

Comments
 (0)