Skip to content

Commit

Permalink
reload setting files
Browse files Browse the repository at this point in the history
  • Loading branch information
S.monzavi authored and S.monzavi committed Apr 17, 2023
1 parent f07e5fb commit f6372da
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 9 deletions.
14 changes: 14 additions & 0 deletions .logs/servicecontrol-audit/logfile.2023-04-17.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
2023-04-17 10:22:26.2811|1|Info|LoggingConfiguration|Logging to C:\Users\S.monzavi\source\repos\TibaResearch\.logs\servicecontrol-audit\logfile.2023-04-17.txt with LogLevel 'Info'
2023-04-17 10:22:26.5526|1|Info|ServiceControl.Audit.Infrastructure.Settings.Settings|No settings found for audit log queue to import, default name will be used
2023-04-17 10:22:26.6532|1|Info|ServiceControl.Audit.Infrastructure.Bootstrapper|
-------------------------------------------------------------
ServiceControl Audit Version: 4.29.3+185657adcc17d5832d9c3093f55f019bd80862ec
Audit Retention Period: 10.00:00:00
Forwarding Audit Messages: False
Database Size: b
Database Folder Size: b
ServiceControl Logging Level: Info
RavenDB Logging Level: Warn
Transport Customization: ServiceControl.Transports.Learning.LearningTransportCustomization, ServiceControl.Transports.Learning,
Persistence: InMemory
-------------------------------------------------------------
15 changes: 15 additions & 0 deletions .logs/servicecontrol/logfile.2023-04-17.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
2023-04-17 10:22:25.9875|1|Info|ServiceBus.Management.Infrastructure.Settings.Settings|No settings found for error log queue to import, default name will be used
2023-04-17 10:22:26.6109|1|Info|Particular.ServiceControl.Bootstrapper|
-------------------------------------------------------------
ServiceControl Version: 4.29.3+185657adcc17d5832d9c3093f55f019bd80862ec
Audit Retention Period (optional):
Error Retention Period: 10.00:00:00
Ingest Error Messages: True
Forwarding Error Messages: False
Database Size: 1.05 MB
Database Folder Size: 68.77 MB
ServiceControl Logging Level: Info
RavenDB Logging Level: Warn
Selected Transport Customization: ServiceControl.Transports.Learning.LearningTransportCustomization, ServiceControl.Transports.Learning
-------------------------------------------------------------
2023-04-17 10:22:27.3068|1|Info|ServiceControl.Infrastructure.RavenDB.RavenBootstrapper|Loading Embedded RavenDB license
19 changes: 12 additions & 7 deletions Host.Research/ConsoleHostedService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace HostSample
Expand All @@ -12,14 +13,16 @@ public class ConsoleHostedService : IHostedService
private readonly IServiceD _serviceD;
private readonly IMyClass _myClass;
private readonly IMyClassSecurity _myClassSecurity;
private readonly IConfiguration _configuration;
public ConsoleHostedService(
ILogger<ConsoleHostedService> logger,
IHostApplicationLifetime appLifetime,
IWeatherService weatherService,
IServiceC serviceC,
IServiceD serviceD,
IMyClass myClass,
IMyClassSecurity myClassSecurity
IMyClassSecurity myClassSecurity,
IConfiguration configuration
)
{
_logger = logger;
Expand All @@ -29,6 +32,7 @@ IMyClassSecurity myClassSecurity
_serviceD = serviceD;
_myClass = myClass;
_myClassSecurity = myClassSecurity;
_configuration = configuration;
}

public Task StartAsync(CancellationToken cancellationToken)
Expand All @@ -54,10 +58,11 @@ public Task StartAsync(CancellationToken cancellationToken)

_logger.LogInformation($"App Started....");

// Simulate real work is being done
for (int i = 0; i < 4; i++)
// Simulate real work is being done
for (int i = 0; i < 50; i++)
{
_logger.LogInformation($"Working {1} .....");
_logger.LogWarning($"Working {1}.....");

await Task.Delay(1000);
}

Expand All @@ -68,8 +73,8 @@ public Task StartAsync(CancellationToken cancellationToken)
}
finally
{
// Stop the application once the work is done
_appLifetime.StopApplication();
// Stop the application once the work is done
_appLifetime.StopApplication();
_appLifetime.ApplicationStopping.Register(() =>
{
_logger.LogInformation("Application is stopping");
Expand Down
4 changes: 3 additions & 1 deletion Host.Research/HostSample.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -13,7 +13,9 @@
<PackageReference Include="Castle.Windsor.MsDependencyInjection" Version="3.4.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Winton.Extensions.Configuration.Consul" Version="3.3.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
</ItemGroup>

</Project>
11 changes: 10 additions & 1 deletion Host.Research/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

class Program
{
static async Task Main(string[] args)
{

var builder = Host.CreateDefaultBuilder(args)

.UseServiceProviderFactory(new WindsorServiceProviderFactory())
.ConfigureContainer<WindsorContainer>((hostBuilderContext, container) =>
{
Expand Down Expand Up @@ -58,11 +60,18 @@ static async Task Main(string[] args)
.ConfigureAppConfiguration((context, config) =>
{
config.SetBasePath(Directory.GetCurrentDirectory());
config.AddJsonFile("hostsettings.json", optional: true);
config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
//config.AddJsonFile("myconfig.json", optional: false, reloadOnChange: true);
config.AddEnvironmentVariables(prefix: "PREFIX_");
})
.ConfigureLogging((hostingContext, logging) =>
{
//logging.ClearProviders();
//logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
})
.UseConsoleLifetime();


var app = builder.Build();

await app.RunAsync();
Expand Down
15 changes: 15 additions & 0 deletions Host.Research/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Logging": {
"LogLevel": {
"Default": "Error",
"Microsoft.AspNetCore": "Warning"
}
},

"AppOptions": {
"DefaultHomepage": "Counter"
},

"AllowedHosts": "*",
"Shirin": true
}

0 comments on commit f6372da

Please sign in to comment.