Skip to content

Commit fada8df

Browse files
committed
Intermediate test adding cert exclusion.
1 parent 4077ec0 commit fada8df

File tree

3 files changed

+980
-88
lines changed

3 files changed

+980
-88
lines changed

src/sample/Program.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
using System.Net;
44
using System.Threading;
55
using Serilog;
6+
using Serilog.Configuration;
67
using Serilog.Core;
8+
using Serilog.Events;
79
using Serilog.Sinks.Splunk;
810

911
namespace Sample
@@ -12,14 +14,28 @@ public class Program
1214
{
1315
public static void Main(string[] args)
1416
{
15-
string splunkHost = "https://192.168.71.1:8088";
17+
string splunkHost = "http://192.168.71.1:8088/services/collector/event";
1618
string splunkEventCollectorToken = "274AD921-FB85-429B-B09E-4EE069843218";
17-
19+
20+
#if ServiceManager
21+
22+
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
1823

1924
Log.Logger = new LoggerConfiguration()
2025
.WriteTo.LiterateConsole()
2126
.WriteTo.EventCollector (splunkHost, splunkEventCollectorToken)
2227
.CreateLogger();
28+
#else
29+
var handler = new System.Net.Http.WinHttpHandler();
30+
handler.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
31+
32+
33+
Log.Logger = new LoggerConfiguration()
34+
.WriteTo.LiterateConsole()
35+
.WriteTo.EventCollector (splunkHost, splunkEventCollectorToken, handler)
36+
.CreateLogger();
37+
38+
#endif
2339

2440
Serilog.Debugging.SelfLog.Out = Console.Out;
2541

@@ -34,6 +50,6 @@ public static void Main(string[] args)
3450
}
3551

3652
Console.ReadLine();
37-
}
53+
}
3854
}
3955
}

src/sample/project.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@
1313
"dependencies": {
1414
"Serilog.Sinks.Literate": "2.0.0-beta-21",
1515
"Serilog.Sinks.Splunk": { "target": "project" }
16+
1617
},
1718

1819
"commands": {
1920
"Sample": "run"
2021
},
2122

2223
"frameworks": {
24+
2325
"dnx451": {
24-
"dependencies": {
25-
},
26+
"compilationOptions": {"define": ["ServiceManager"]},
2627
"frameworkAssemblies": {
27-
"System.Net": "4.0.0.0"
28+
"System.Net": "4.0.0.0",
29+
"System.Net.Http": "4.0.0.0"
2830
}
2931
},
3032
"dnxcore50": {
@@ -33,7 +35,9 @@
3335
"System.Collections": "4.0.11-beta-23516",
3436
"System.Console": "4.0.0-beta-23516",
3537
"System.Linq": "4.0.1-beta-23516",
36-
"System.Threading": "4.0.11-beta-23516"
38+
"System.Threading": "4.0.11-beta-23516",
39+
"System.Net.Http": "4.0.1-beta-23516",
40+
"System.Net.Http.WinHttpHandler": "4.0.0-beta-23516"
3741
}
3842
}
3943
}

0 commit comments

Comments
 (0)