Skip to content

Commit ddb7568

Browse files
committed
allow seq url to be configured
2 parents 9ab9af6 + 56a4635 commit ddb7568

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

src/ServiceControl.Audit/App.config

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ These settings are only here so that we can debug ServiceControl while developin
2222
<add key="ServiceControl.Audit/PersistenceType" value="InMemory" />
2323
<!--<add key="ServiceControl.Audit/PersistenceType" value="RavenDB" />-->
2424

25-
<!-- options are any comma separated combination of NLog,Seq -->
26-
<add key="ServiceControl.Audit/LoggingProviders" value="NLog,Seq"/>
25+
<!-- options are any comma separated combination of NLog,Seq -->
26+
<add key="ServiceControl.Audit/LoggingProviders" value="NLog,Seq"/>
27+
<add key="ServiceControl.Audit/SeqAddress" value="http://localhost:5341"/>
2728
</appSettings>
2829
<connectionStrings>
2930
<!-- DEVS - Pick a transport connection string to match chosen transport above -->

src/ServiceControl.Infrastructure/LoggerUtil.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public static class LoggerUtil
1919
{
2020
public static Loggers ActiveLoggers { private get; set; } = Loggers.None;
2121

22+
public static string SeqAddress { private get; set; }
23+
2224
public static bool IsLoggingTo(Loggers logger)
2325
{
2426
return (logger & ActiveLoggers) == logger;
@@ -36,7 +38,14 @@ public static void BuildLogger(this ILoggingBuilder loggingBuilder, LogLevel lev
3638
}
3739
if (IsLoggingTo(Loggers.Seq))
3840
{
39-
loggingBuilder.AddSeq();
41+
if (!string.IsNullOrWhiteSpace(SeqAddress))
42+
{
43+
loggingBuilder.AddSeq(SeqAddress);
44+
}
45+
else
46+
{
47+
loggingBuilder.AddSeq();
48+
}
4049
}
4150

4251
loggingBuilder.SetMinimumLevel(level);

src/ServiceControl.Infrastructure/LoggingSettings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public LoggingSettings(SettingsRootNamespace rootNamespace, LogLevel defaultLeve
2020
if (loggingProviders.Contains("Seq"))
2121
{
2222
activeLoggers |= Loggers.Seq;
23+
var seqAddress = SettingsReader.Read<string>(rootNamespace, seqAddressKey);
24+
if (!string.IsNullOrWhiteSpace(seqAddress))
25+
{
26+
LoggerUtil.SeqAddress = seqAddress;
27+
}
2328
}
2429
//this defaults to NLog because historically that was the default, and we don't want to break existing installs that don't have the config key to define loggingProviders
2530
LoggerUtil.ActiveLoggers = activeLoggers == Loggers.None ? Loggers.NLog : activeLoggers;
@@ -78,4 +83,5 @@ static LogLevel ParseLogLevel(string value, LogLevel defaultLevel)
7883
const string logLevelKey = "LogLevel";
7984
const string logPathKey = "LogPath";
8085
const string loggingProvidersKey = "LoggingProviders";
86+
const string seqAddressKey = "SeqAddress";
8187
}

src/ServiceControl.Monitoring/App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ These settings are only here so that we can debug ServiceControl while developin
1919
<!--<add key="Monitoring/TransportType" value="RabbitMQ.QuorumConventionalRouting" />-->
2020
<!--<add key="Monitoring/TransportType" value="SQLServer" />-->
2121

22+
<!-- options are any comma separated combination of NLog,Seq -->
23+
<add key="Monitoring/LoggingProviders" value="NLog,Seq"/>
24+
<add key="Monitoring/SeqAddress" value="http://localhost:5341"/>
2225
</appSettings>
2326
<connectionStrings>
2427
<!-- DEVS - Pick a transport connection string to match chosen transport above -->

src/ServiceControl/App.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ These settings are only here so that we can debug ServiceControl while developin
2323
<!--<add key="ServiceControl/TransportType" value="SQLServer" />-->
2424

2525
<add key="ServiceControl/PersistenceType" value="RavenDB" />
26+
27+
<!-- options are any comma separated combination of NLog,Seq -->
28+
<add key="ServiceControl/LoggingProviders" value="NLog,Seq"/>
29+
<add key="ServiceControl/SeqAddress" value="http://localhost:5341"/>
2630
</appSettings>
2731
<connectionStrings>
2832
<!-- DEVS - Pick a transport connection string to match chosen transport above -->

0 commit comments

Comments
 (0)