Skip to content

Commit 56a4635

Browse files
committed
enable seq url to be configured
1 parent 39039ed commit 56a4635

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

src/ServiceControl.Audit/App.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ These settings are only here so that we can debug ServiceControl while developin
2424

2525
<!-- options are any comma separated combination of NLog,Seq -->
2626
<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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ These settings are only here so that we can debug ServiceControl while developin
2020
<!--<add key="Monitoring/TransportType" value="SQLServer" />-->
2121

2222
<!-- options are any comma separated combination of NLog,Seq -->
23-
<add key="ServiceControl.Audit/LoggingProviders" value="NLog,Seq"/>
23+
<add key="Monitoring/LoggingProviders" value="NLog,Seq"/>
24+
<add key="Monitoring/SeqAddress" value="http://localhost:5341"/>
2425
</appSettings>
2526
<connectionStrings>
2627
<!-- DEVS - Pick a transport connection string to match chosen transport above -->

src/ServiceControl/App.config

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,27 @@ These settings are only here so that we can debug ServiceControl while developin
1313
<add key="ServiceControl/AllowMessageEditing" value="true" />
1414

1515
<!-- DEVS - Pick a transport to run Primary instance on -->
16-
<add key="ServiceControl/TransportType" value="LearningTransport" />
16+
<!--<add key="ServiceControl/TransportType" value="LearningTransport" />-->
1717
<!--<add key="ServiceControl/TransportType" value="AmazonSQS" />-->
1818
<!--<add key="ServiceControl/TransportType" value="AzureStorageQueue" />-->
1919
<!--<add key="ServiceControl/TransportType" value="MSMQ" />-->
2020
<!--<add key="ServiceControl/TransportType" value="NetStandardAzureServiceBus" />-->
2121
<!--<add key="ServiceControl/TransportType" value="PostgreSQL" />-->
22-
<!--<add key="ServiceControl/TransportType" value="RabbitMQ.QuorumConventionalRouting" />-->
22+
<add key="ServiceControl/TransportType" value="RabbitMQ.QuorumConventionalRouting" />
2323
<!--<add key="ServiceControl/TransportType" value="SQLServer" />-->
2424

2525
<add key="ServiceControl/PersistenceType" value="RavenDB" />
2626

2727
<!-- options are any comma separated combination of NLog,Seq -->
28-
<add key="ServiceControl.Audit/LoggingProviders" value="NLog,Seq"/>
28+
<add key="ServiceControl/LoggingProviders" value="NLog,Seq"/>
29+
<add key="ServiceControl/SeqAddress" value="http://localhost:5341"/>
2930
</appSettings>
3031
<connectionStrings>
3132
<!-- DEVS - Pick a transport connection string to match chosen transport above -->
3233

3334
<!-- Learning -->
3435
<!-- If the LearningTransport connectionString is empty, it will default to the solution directory when running/debugging from the IDE -->
35-
<add name="NServiceBus/Transport" connectionString="" />
36+
<!--<add name="NServiceBus/Transport" connectionString="" />-->
3637

3738
<!--Amazon SQS -->
3839
<!--<add name="NServiceBus/Transport" connectionString="Region=;QueueNamePrefix=;TopicNamePrefix=;AccessKeyId=;SecretAccessKey=;S3BucketForLargeMessages=;S3KeyPrefix=" />-->
@@ -51,6 +52,7 @@ These settings are only here so that we can debug ServiceControl while developin
5152

5253
<!--RabbitMQ.QuorumConventionalRouting -->
5354
<!--<add name="NServiceBus/Transport" connectionString="host=;username=;password=" />-->
55+
<add name="NServiceBus/Transport" connectionString="host=localhost:7672;username=guest;password=guest;ManagementApiUrl=http://localhost:17672" />
5456

5557
<!--SQLServer -->
5658
<!--<add name="NServiceBus/Transport" connectionString="Data Source=;Initial Catalog=nservicebus;Integrated Security=True;Queue Schema=myschema;Subscriptions Table=tablename@schema@catalog" />-->

0 commit comments

Comments
 (0)