diff --git a/src/Umbraco.Core/Logging/ILoggingConfiguration.cs b/src/Umbraco.Core/Logging/ILoggingConfiguration.cs index 47e2d8fa7c..d21a08e688 100644 --- a/src/Umbraco.Core/Logging/ILoggingConfiguration.cs +++ b/src/Umbraco.Core/Logging/ILoggingConfiguration.cs @@ -7,7 +7,5 @@ /// The physical path where logs are stored /// string LogDirectory { get; } - string LogConfigurationFile { get; } - string UserLogConfigurationFile { get; } } } diff --git a/src/Umbraco.Core/Logging/LoggingConfiguration.cs b/src/Umbraco.Core/Logging/LoggingConfiguration.cs index c657c9d430..ecd806211c 100644 --- a/src/Umbraco.Core/Logging/LoggingConfiguration.cs +++ b/src/Umbraco.Core/Logging/LoggingConfiguration.cs @@ -4,17 +4,11 @@ namespace Umbraco.Core.Logging { public class LoggingConfiguration : ILoggingConfiguration { - public LoggingConfiguration(string logDirectory, string logConfigurationFile, string userLogConfigurationFile) + public LoggingConfiguration(string logDirectory) { LogDirectory = logDirectory ?? throw new ArgumentNullException(nameof(logDirectory)); - LogConfigurationFile = logConfigurationFile ?? throw new ArgumentNullException(nameof(logConfigurationFile)); - UserLogConfigurationFile = userLogConfigurationFile ?? throw new ArgumentNullException(nameof(userLogConfigurationFile)); } public string LogDirectory { get; } - - public string LogConfigurationFile { get; } - - public string UserLogConfigurationFile { get; } } } diff --git a/src/Umbraco.Infrastructure/Composing/HostBuilderExtensions.cs b/src/Umbraco.Infrastructure/Composing/HostBuilderExtensions.cs index f6d980f62a..ad7c75b94f 100644 --- a/src/Umbraco.Infrastructure/Composing/HostBuilderExtensions.cs +++ b/src/Umbraco.Infrastructure/Composing/HostBuilderExtensions.cs @@ -26,7 +26,6 @@ namespace Umbraco.Core.Composing /// /// public static IHostBuilder UseUmbraco(this IHostBuilder builder, UmbracoServiceProviderFactory umbracoServiceProviderFactory) - => builder.UseServiceProviderFactory(umbracoServiceProviderFactory) - .UseSerilog(); + => builder.UseServiceProviderFactory(umbracoServiceProviderFactory); } } diff --git a/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs b/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs index f2e028e6de..a5e5bdee43 100644 --- a/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs +++ b/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs @@ -7,7 +7,6 @@ using Serilog.Core; using Serilog.Events; using Serilog.Formatting; using Serilog.Formatting.Compact; -using Umbraco.Core.IO; using Umbraco.Core.Hosting; using Umbraco.Core.Logging.Serilog.Enrichers; @@ -61,7 +60,7 @@ namespace Umbraco.Core.Logging.Serilog public static LoggerConfiguration OutputDefaultTextFile( this LoggerConfiguration logConfig, IHostingEnvironment hostingEnvironment, - ILoggingConfiguration loggingConfiguration, LogEventLevel minimumLevel = LogEventLevel.Verbose, int? retainedFileCount = null) + LogEventLevel minimumLevel = LogEventLevel.Verbose) { //Main .txt logfile - in similar format to older Log4Net output //Ends with ..txt as Date is inserted before file extension substring @@ -79,18 +78,25 @@ namespace Umbraco.Core.Logging.Serilog /// /// Used in config - If renamed or moved to other assembly the config file also has be updated. /// - public static LoggerConfiguration File(this LoggerSinkConfiguration configuration, ITextFormatter formatter, + public static LoggerConfiguration UmbracoFile(this LoggerSinkConfiguration configuration, string path, + ITextFormatter formatter = null, LogEventLevel restrictedToMinimumLevel = LogEventLevel.Verbose, LoggingLevelSwitch levelSwitch = null, long? fileSizeLimitBytes = 1073741824, TimeSpan? flushToDiskInterval = null, - RollingInterval rollingInterval = RollingInterval.Infinite, + RollingInterval rollingInterval = RollingInterval.Day, bool rollOnFileSizeLimit = false, int? retainedFileCountLimit = 31, Encoding encoding = null ) { + + if (formatter is null) + { + formatter = new CompactJsonFormatter(); + } + return configuration.Async( asyncConfiguration => asyncConfiguration.Map(AppDomainId, (_,mapConfiguration) => mapConfiguration.File( @@ -136,34 +142,5 @@ namespace Umbraco.Core.Logging.Serilog return logConfig; } - /// - /// Reads settings from /config/serilog.config - /// That allows the main logging pipeline to be configured - /// - /// A Serilog LoggerConfiguration - /// - public static LoggerConfiguration ReadFromConfigFile(this LoggerConfiguration logConfig, ILoggingConfiguration loggingConfiguration) - { - //Read from main serilog.config file - logConfig.ReadFrom.AppSettings(filePath: loggingConfiguration.LogConfigurationFile); - - return logConfig; - } - - /// - /// Reads settings from /config/serilog.user.config - /// That allows a separate logging pipeline to be configured that will not affect the main Umbraco log - /// - /// A Serilog LoggerConfiguration - /// - public static LoggerConfiguration ReadFromUserConfigFile(this LoggerConfiguration logConfig, ILoggingConfiguration loggingConfiguration) - { - //A nested logger - where any user configured sinks via config can not effect the main 'umbraco' logger above - logConfig.WriteTo.Logger(cfg => - cfg.ReadFrom.AppSettings(filePath: loggingConfiguration.UserLogConfigurationFile)); - - return logConfig; - } - } } diff --git a/src/Umbraco.Infrastructure/Logging/Serilog/SerilogLogger.cs b/src/Umbraco.Infrastructure/Logging/Serilog/SerilogLogger.cs index 38af9554ab..7b8b83c59a 100644 --- a/src/Umbraco.Infrastructure/Logging/Serilog/SerilogLogger.cs +++ b/src/Umbraco.Infrastructure/Logging/Serilog/SerilogLogger.cs @@ -1,7 +1,9 @@ using System; using System.IO; +using Microsoft.Extensions.Configuration; using Serilog; using Serilog.Events; +using Serilog.Extensions.Logging; using Umbraco.Core.Hosting; namespace Umbraco.Core.Logging.Serilog @@ -35,13 +37,14 @@ namespace Umbraco.Core.Logging.Serilog /// Creates a logger with some pre-defined configuration and remainder from config file /// /// Used by UmbracoApplicationBase to get its logger. - public static SerilogLogger CreateWithDefaultConfiguration(IHostingEnvironment hostingEnvironment, ILoggingConfiguration loggingConfiguration) + public static SerilogLogger CreateWithDefaultConfiguration( + IHostingEnvironment hostingEnvironment, + ILoggingConfiguration loggingConfiguration, + IConfiguration configuration) { - var loggerConfig = new LoggerConfiguration(); - loggerConfig + var loggerConfig = new LoggerConfiguration() .MinimalConfiguration(hostingEnvironment, loggingConfiguration) - .ReadFromConfigFile(loggingConfiguration) - .ReadFromUserConfigFile(loggingConfiguration); + .ReadFrom.Configuration(configuration); return new SerilogLogger(loggerConfig); } @@ -83,7 +86,7 @@ namespace Umbraco.Core.Logging.Serilog /// public void Fatal(Type reporting, Exception exception, string message) { - var logger = LoggerFor(reporting); + var logger = LoggerFor(reporting); logger.Fatal(exception, message); } @@ -91,7 +94,7 @@ namespace Umbraco.Core.Logging.Serilog public void Fatal(Type reporting, Exception exception) { var logger = LoggerFor(reporting); - var message = "Exception."; + var message = "Exception."; logger.Fatal(exception, message); } @@ -110,14 +113,14 @@ namespace Umbraco.Core.Logging.Serilog /// public void Fatal(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues) { - var logger = LoggerFor(reporting); + var logger = LoggerFor(reporting); logger.Fatal(exception, messageTemplate, propertyValues); } /// public void Error(Type reporting, Exception exception, string message) { - var logger = LoggerFor(reporting); + var logger = LoggerFor(reporting); logger.Error(exception, message); } diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/LogViewerComposer.cs b/src/Umbraco.Infrastructure/Logging/Viewer/LogViewerComposer.cs index 0909ec67ad..d340bb817f 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/LogViewerComposer.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/LogViewerComposer.cs @@ -11,16 +11,6 @@ namespace Umbraco.Core.Logging.Viewer { public void Compose(Composition composition) { - - - composition.RegisterUnique(factory => - { - var hostingEnvironment = factory.GetInstance(); - return new LoggingConfiguration( - Path.Combine(hostingEnvironment.ApplicationPhysicalPath, "App_Data", "Logs"), - Path.Combine(hostingEnvironment.ApplicationPhysicalPath, "config", "serilog.config"), - Path.Combine(hostingEnvironment.ApplicationPhysicalPath, "config", "serilog.user.config")); - }); composition.RegisterUnique(); composition.SetLogViewer(); composition.RegisterUnique(factory => diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj index adb2a95202..3407758c86 100644 --- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj +++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj @@ -34,6 +34,7 @@ + diff --git a/src/Umbraco.Tests.Common/TestHelperBase.cs b/src/Umbraco.Tests.Common/TestHelperBase.cs index 8a4ed3f40e..163f551d47 100644 --- a/src/Umbraco.Tests.Common/TestHelperBase.cs +++ b/src/Umbraco.Tests.Common/TestHelperBase.cs @@ -147,9 +147,7 @@ namespace Umbraco.Tests.Common { hostingEnv = hostingEnv ?? GetHostingEnvironment(); return new LoggingConfiguration( - Path.Combine(hostingEnv.ApplicationPhysicalPath, "App_Data","Logs"), - Path.Combine(hostingEnv.ApplicationPhysicalPath, "config","serilog.config"), - Path.Combine(hostingEnv.ApplicationPhysicalPath, "config","serilog.user.config")); + Path.Combine(hostingEnv.ApplicationPhysicalPath, "umbraco","logs")); } } } diff --git a/src/Umbraco.Tests.Integration/RuntimeTests.cs b/src/Umbraco.Tests.Integration/RuntimeTests.cs index 07a0db167c..d51c31f896 100644 --- a/src/Umbraco.Tests.Integration/RuntimeTests.cs +++ b/src/Umbraco.Tests.Integration/RuntimeTests.cs @@ -101,7 +101,7 @@ namespace Umbraco.Tests.Integration // Add it! services.AddUmbracoConfiguration(hostContext.Configuration); - services.AddUmbracoCore(webHostEnvironment, umbracoContainer, GetType().Assembly, AppCaches.NoCache, testHelper.GetLoggingConfiguration(), out _); + services.AddUmbracoCore(webHostEnvironment, umbracoContainer, GetType().Assembly, AppCaches.NoCache, testHelper.GetLoggingConfiguration(), hostContext.Configuration,out _); }); var host = await hostBuilder.StartAsync(); @@ -141,7 +141,7 @@ namespace Umbraco.Tests.Integration // Add it! services.AddUmbracoConfiguration(hostContext.Configuration); - services.AddUmbracoCore(webHostEnvironment, umbracoContainer, GetType().Assembly, AppCaches.NoCache, testHelper.GetLoggingConfiguration(), out _); + services.AddUmbracoCore(webHostEnvironment, umbracoContainer, GetType().Assembly, AppCaches.NoCache, testHelper.GetLoggingConfiguration(),hostContext.Configuration, out _); }); var host = await hostBuilder.StartAsync(); diff --git a/src/Umbraco.Tests.Integration/TestServerTest/UmbracoBuilderExtensions.cs b/src/Umbraco.Tests.Integration/TestServerTest/UmbracoBuilderExtensions.cs index ba96c06826..6f588d5ac7 100644 --- a/src/Umbraco.Tests.Integration/TestServerTest/UmbracoBuilderExtensions.cs +++ b/src/Umbraco.Tests.Integration/TestServerTest/UmbracoBuilderExtensions.cs @@ -28,6 +28,7 @@ namespace Umbraco.Tests.Integration.TestServerTest typeof(UmbracoBuilderExtensions).Assembly, AppCaches.NoCache, // Disable caches in integration tests testHelper.GetLoggingConfiguration(), + builder.Config, // TODO: Yep that's extremely ugly (configs, umbVersion, ioHelper, logger, profiler, hostingEnv, backOfficeInfo, typeFinder, appCaches, dbProviderFactoryCreator) => { @@ -46,7 +47,7 @@ namespace Umbraco.Tests.Integration.TestServerTest dbInstallEventHandler); // DB Installation event handler return runtime; - }, + }, out _); }); } diff --git a/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs b/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs index c9e88b9deb..d4e9a427b7 100644 --- a/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs +++ b/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs @@ -81,7 +81,7 @@ namespace Umbraco.Tests.Integration.Testing { var hostBuilder = CreateHostBuilder(); var host = await hostBuilder.StartAsync(); - Services = host.Services; + Services = host.Services; var app = new ApplicationBuilder(host.Services); Configure(app); } @@ -141,7 +141,7 @@ namespace Umbraco.Tests.Integration.Testing logger, profiler, hostingEnvironment, - backOfficeInfo, + backOfficeInfo, typeFinder, appCaches, dbProviderFactoryCreator, @@ -181,7 +181,7 @@ namespace Umbraco.Tests.Integration.Testing profiler, Mock.Of(), hostingEnvironment, - backOfficeInfo, + backOfficeInfo, dbProviderFactoryCreator, mainDom, typeFinder, @@ -210,6 +210,7 @@ namespace Umbraco.Tests.Integration.Testing GetType().Assembly, AppCaches.NoCache, // Disable caches for integration tests TestHelper.GetLoggingConfiguration(), + Configuration, CreateTestRuntime, out _); diff --git a/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs b/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs index dd91a2cca9..5b4876baca 100644 --- a/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs +++ b/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs @@ -26,7 +26,7 @@ namespace Umbraco.Web.Common.Builder => builder.AddWith(nameof(WithConfiguration), () => builder.Services.AddUmbracoConfiguration(builder.Config)); public static IUmbracoBuilder WithCore(this IUmbracoBuilder builder) - => builder.AddWith(nameof(WithCore), () => builder.Services.AddUmbracoCore(builder.WebHostEnvironment, out _)); + => builder.AddWith(nameof(WithCore), () => builder.Services.AddUmbracoCore(builder.WebHostEnvironment, builder.Config, out _)); public static IUmbracoBuilder WithMiniProfiler(this IUmbracoBuilder builder) => builder.AddWith(nameof(WithMiniProfiler), () => @@ -34,7 +34,7 @@ namespace Umbraco.Web.Common.Builder { options.ShouldProfile = request => false; // WebProfiler determine and start profiling. We should not use the MiniProfilerMiddleware to also profile })); - + public static IUmbracoBuilder WithMvcAndRazor(this IUmbracoBuilder builder, Action mvcOptions = null, Action mvcBuilding = null) => builder.AddWith(nameof(WithMvcAndRazor), () => { diff --git a/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs b/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs index fd24122b3d..e3eac7c588 100644 --- a/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs +++ b/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs @@ -119,10 +119,11 @@ namespace Umbraco.Extensions /// /// /// + /// /// - public static IServiceCollection AddUmbracoCore(this IServiceCollection services, IWebHostEnvironment webHostEnvironment) + public static IServiceCollection AddUmbracoCore(this IServiceCollection services, IWebHostEnvironment webHostEnvironment, IConfiguration configuration) { - return services.AddUmbracoCore(webHostEnvironment, out _); + return services.AddUmbracoCore(webHostEnvironment, configuration, out _); } /// @@ -130,9 +131,10 @@ namespace Umbraco.Extensions /// /// /// + /// /// /// - public static IServiceCollection AddUmbracoCore(this IServiceCollection services, IWebHostEnvironment webHostEnvironment, out IFactory factory) + public static IServiceCollection AddUmbracoCore(this IServiceCollection services, IWebHostEnvironment webHostEnvironment, IConfiguration configuration, out IFactory factory) { if (!UmbracoServiceProviderFactory.IsActive) throw new InvalidOperationException("Ensure to add UseUmbraco() in your Program.cs after ConfigureWebHostDefaults to enable Umbraco's service provider factory"); @@ -140,12 +142,11 @@ namespace Umbraco.Extensions var umbContainer = UmbracoServiceProviderFactory.UmbracoContainer; var loggingConfig = new LoggingConfiguration( - Path.Combine(webHostEnvironment.ContentRootPath, "App_Data", "Logs"), - Path.Combine(webHostEnvironment.ContentRootPath, "config", "serilog.config"), - Path.Combine(webHostEnvironment.ContentRootPath, "config", "serilog.user.config")); + Path.Combine(webHostEnvironment.ContentRootPath, "umbraco", "logs")); IHttpContextAccessor httpContextAccessor = new HttpContextAccessor(); services.AddSingleton(httpContextAccessor); + services.AddSingleton(loggingConfig); var requestCache = new GenericDictionaryRequestAppCache(() => httpContextAccessor.HttpContext?.Items); var appCaches = new AppCaches( @@ -158,6 +159,7 @@ namespace Umbraco.Extensions Assembly.GetEntryAssembly(), appCaches, loggingConfig, + configuration, out factory); return services; @@ -182,8 +184,9 @@ namespace Umbraco.Extensions Assembly entryAssembly, AppCaches appCaches, ILoggingConfiguration loggingConfiguration, + IConfiguration configuration, out IFactory factory) - => services.AddUmbracoCore(webHostEnvironment, umbContainer, entryAssembly, appCaches, loggingConfiguration, GetCoreRuntime, out factory); + => services.AddUmbracoCore(webHostEnvironment, umbContainer, entryAssembly, appCaches, loggingConfiguration, configuration, GetCoreRuntime, out factory); /// @@ -206,6 +209,7 @@ namespace Umbraco.Extensions Assembly entryAssembly, AppCaches appCaches, ILoggingConfiguration loggingConfiguration, + IConfiguration configuration, // TODO: Yep that's extremely ugly Func getRuntime, out IFactory factory) @@ -241,6 +245,7 @@ namespace Umbraco.Extensions configs, webHostEnvironment, loggingConfiguration, + configuration, out var logger, out var ioHelper, out var hostingEnvironment, out var backOfficeInfo, out var profiler); var globalSettings = configs.Global(); @@ -248,7 +253,7 @@ namespace Umbraco.Extensions var typeFinder = CreateTypeFinder(logger, profiler, webHostEnvironment, entryAssembly, configs.TypeFinder()); var runtime = getRuntime( - configs, + configs, umbracoVersion, ioHelper, logger, @@ -291,7 +296,7 @@ namespace Umbraco.Extensions var mainDom = new MainDom(logger, mainDomLock); var coreRuntime = new CoreRuntime( - configs, + configs, umbracoVersion, ioHelper, logger, @@ -312,6 +317,7 @@ namespace Umbraco.Extensions Configs configs, IWebHostEnvironment webHostEnvironment, ILoggingConfiguration loggingConfiguration, + IConfiguration configuration, out Core.Logging.ILogger logger, out IIOHelper ioHelper, out Core.Hosting.IHostingEnvironment hostingEnvironment, @@ -326,8 +332,7 @@ namespace Umbraco.Extensions hostingEnvironment = new AspNetCoreHostingEnvironment(hostingSettings, webHostEnvironment); ioHelper = new IOHelper(hostingEnvironment); - logger = AddLogger(services, hostingEnvironment, loggingConfiguration); - + logger = AddLogger(services, hostingEnvironment, loggingConfiguration, configuration); backOfficeInfo = new AspNetCoreBackOfficeInfo(globalSettings); profiler = GetWebProfiler(hostingEnvironment); @@ -338,10 +343,14 @@ namespace Umbraco.Extensions /// Create and configure the logger /// /// - private static Core.Logging.ILogger AddLogger(IServiceCollection services, Core.Hosting.IHostingEnvironment hostingEnvironment, ILoggingConfiguration loggingConfiguration) + private static Core.Logging.ILogger AddLogger(IServiceCollection services, Core.Hosting.IHostingEnvironment hostingEnvironment, ILoggingConfiguration loggingConfiguration, IConfiguration configuration) { // Create a serilog logger - var logger = SerilogLogger.CreateWithDefaultConfiguration(hostingEnvironment, loggingConfiguration); + var logger = SerilogLogger.CreateWithDefaultConfiguration(hostingEnvironment, loggingConfiguration, configuration); + + // This is nessasary to pick up all the loggins to MS ILogger. + Log.Logger = logger.SerilogLog; + // Wire up all the bits that serilog needs. We need to use our own code since the Serilog ext methods don't cater to our needs since // we don't want to use the global serilog `Log` object and we don't have our own ILogger implementation before the HostBuilder runs which @@ -349,6 +358,11 @@ namespace Umbraco.Extensions // I have created a PR to make this nicer https://github.com/serilog/serilog-extensions-hosting/pull/19 but we'll need to wait for that. // Also see : https://github.com/serilog/serilog-extensions-hosting/blob/dev/src/Serilog.Extensions.Hosting/SerilogHostBuilderExtensions.cs + // services.AddLogging(configure => + // { + // configure.AddSerilog(); + // }); + services.AddSingleton(services => new SerilogLoggerFactory(logger.SerilogLog, false)); // This won't (and shouldn't) take ownership of the logger. diff --git a/src/Umbraco.Web.UI.NetCore/Umbraco.Web.UI.NetCore.csproj b/src/Umbraco.Web.UI.NetCore/Umbraco.Web.UI.NetCore.csproj index 39df6b94ef..e5304bed39 100644 --- a/src/Umbraco.Web.UI.NetCore/Umbraco.Web.UI.NetCore.csproj +++ b/src/Umbraco.Web.UI.NetCore/Umbraco.Web.UI.NetCore.csproj @@ -18,7 +18,7 @@ - + @@ -59,11 +59,11 @@ - - - + + + - + diff --git a/src/Umbraco.Web.UI.NetCore/Views/asda.cshtml b/src/Umbraco.Web.UI.NetCore/Views/asda.cshtml deleted file mode 100644 index 3fa17ab54c..0000000000 --- a/src/Umbraco.Web.UI.NetCore/Views/asda.cshtml +++ /dev/null @@ -1,4 +0,0 @@ -@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage -@{ - Layout = null; -} \ No newline at end of file diff --git a/src/Umbraco.Web.UI.NetCore/appsettings.Development.json b/src/Umbraco.Web.UI.NetCore/appsettings.Development.json index 9f81927bdc..453f8cca3d 100644 --- a/src/Umbraco.Web.UI.NetCore/appsettings.Development.json +++ b/src/Umbraco.Web.UI.NetCore/appsettings.Development.json @@ -1,11 +1,28 @@ { + "Serilog": { + "MinimumLevel": { + "Default": "Information" + }, + "WriteTo:1": + { + "Name": "Async", + "Args": { + "configure": [ + { + "Name": "Console" + } + ] + } + } + + }, "Umbraco": { "CMS": { "Global":{ "Smtp": { - "From": "your@email.here", - "Host": "localhost", - "Port": "25" +// "From": "your@email.here", +// "Host": "localhost", +// "Port": "25" } }, "Hosting":{ diff --git a/src/Umbraco.Web.UI.NetCore/appsettings.json b/src/Umbraco.Web.UI.NetCore/appsettings.json index 3bbb4e7da4..8d63e33804 100644 --- a/src/Umbraco.Web.UI.NetCore/appsettings.json +++ b/src/Umbraco.Web.UI.NetCore/appsettings.json @@ -1,64 +1,83 @@ { - "ConnectionStrings": { - "umbracoDbDSN": "" - }, - "Umbraco": { - "CMS": { - "Content": { - "Notifications": { - "Email": "your@email.here" + "ConnectionStrings": { + "umbracoDbDSN": "Data Source=|DataDirectory|\\Umbraco.sdf;Flush Interval=1;" + }, + "Serilog": { + "Using": [ + "Umbraco.Infrastructure" + ], + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information", + "System": "Warning" + } }, - "MacroErrors": "throw" - }, - "Global": { - "DefaultUILanguage": "en-us", - "HideTopLevelNodeFromPath": true, - "Path": "~/umbraco", - "TimeOutInMinutes": 20, - "UseHttps": false - }, - "Hosting": { - "Debug": false - }, - "KeepAlive": { - "DisableKeepAliveTask": false, - "KeepAlivePingUrl": "{umbracoApplicationUrl}/api/keepalive/ping" - }, - "RequestHandler": { - "ConvertUrlsToAscii": "try" - }, - "RuntimeMinification": { - "dataFolder": "App_Data\\Smidge", - "version": "1" - }, - "Security": { - "KeepUserLoggedIn": false, - "UsernameIsEmail": true, - "HideDisabledUsersInBackoffice": false, - "UserPassword": { - "RequiredLength": 10, - "RequireNonLetterOrDigit": false, - "RequireDigit": false, - "RequireLowercase": false, - "RequireUppercase": false, - "MaxFailedAccessAttemptsBeforeLockout": 5 - }, - "MemberPassword": { - "RequiredLength": 10, - "RequireNonLetterOrDigit": false, - "RequireDigit": false, - "RequireLowercase": false, - "RequireUppercase": false, - "MaxFailedAccessAttemptsBeforeLockout": 5 + "WriteTo:0": { + "Name": "UmbracoFile", + "Args": { + "path" : "%UMBLOGDIR%/UmbracoTraceLog.%MACHINENAME%..json" + } + } + }, + "Umbraco": { + "CMS": { + "Content": { + "Notifications": { + "Email": "your@email.here" + }, + "MacroErrors": "throw" + }, + "Global": { + "DefaultUILanguage": "en-us", + "HideTopLevelNodeFromPath": true, + "Path": "~/umbraco", + "TimeOutInMinutes": 20, + "UseHttps": false + }, + "Hosting": { + "Debug": false + }, + "KeepAlive": { + "DisableKeepAliveTask": false, + "KeepAlivePingUrl": "{umbracoApplicationUrl}/api/keepalive/ping" + }, + "RequestHandler": { + "ConvertUrlsToAscii": "try" + }, + "RuntimeMinification": { + "dataFolder": "App_Data\\Smidge", + "version": "1" + }, + "Security": { + "KeepUserLoggedIn": false, + "UsernameIsEmail": true, + "HideDisabledUsersInBackoffice": false, + "UserPassword": { + "RequiredLength": 10, + "RequireNonLetterOrDigit": false, + "RequireDigit": false, + "RequireLowercase": false, + "RequireUppercase": false, + "MaxFailedAccessAttemptsBeforeLockout": 5 + }, + "MemberPassword": { + "RequiredLength": 10, + "RequireNonLetterOrDigit": false, + "RequireDigit": false, + "RequireLowercase": false, + "RequireUppercase": false, + "MaxFailedAccessAttemptsBeforeLockout": 5 + } + }, + "Tours": { + "EnableTours": true + }, + "ModelsBuilder": { + "ModelsMode": "PureLive", + "Enable": "true" + } } - }, - "Tours": { - "EnableTours": true - }, - "ModelsBuilder": { - "ModelsMode": "PureLive", - "Enable": "true" - } } - } } diff --git a/src/Umbraco.Web.UI.NetCore/config/serilog.Release.config b/src/Umbraco.Web.UI.NetCore/config/serilog.Release.config deleted file mode 100644 index 9aca408b36..0000000000 --- a/src/Umbraco.Web.UI.NetCore/config/serilog.Release.config +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Umbraco.Web.UI.NetCore/config/serilog.config b/src/Umbraco.Web.UI.NetCore/config/serilog.config deleted file mode 100644 index 1b357696b9..0000000000 --- a/src/Umbraco.Web.UI.NetCore/config/serilog.config +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Umbraco.Web.UI.NetCore/config/serilog.user.Release.config b/src/Umbraco.Web.UI.NetCore/config/serilog.user.Release.config deleted file mode 100644 index 8f207406e3..0000000000 --- a/src/Umbraco.Web.UI.NetCore/config/serilog.user.Release.config +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Umbraco.Web.UI.NetCore/config/serilog.user.config b/src/Umbraco.Web.UI.NetCore/config/serilog.user.config deleted file mode 100644 index 8f207406e3..0000000000 --- a/src/Umbraco.Web.UI.NetCore/config/serilog.user.config +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Umbraco.Web/UmbracoApplicationBase.cs b/src/Umbraco.Web/UmbracoApplicationBase.cs index 55ef6747a0..59c8575a4d 100644 --- a/src/Umbraco.Web/UmbracoApplicationBase.cs +++ b/src/Umbraco.Web/UmbracoApplicationBase.cs @@ -1,10 +1,12 @@ using Serilog.Context; using System; +using System.Collections.Generic; using System.IO; using System.Reflection; using System.Threading; using System.Web; using System.Web.Hosting; +using Microsoft.Extensions.Configuration; using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Composing; @@ -41,11 +43,9 @@ namespace Umbraco.Web var hostingEnvironment = new AspNetHostingEnvironment(hostingSettings); var loggingConfiguration = new LoggingConfiguration( - Path.Combine(hostingEnvironment.ApplicationPhysicalPath, "App_Data\\Logs"), - Path.Combine(hostingEnvironment.ApplicationPhysicalPath, "config\\serilog.config"), - Path.Combine(hostingEnvironment.ApplicationPhysicalPath, "config\\serilog.user.config")); + Path.Combine(hostingEnvironment.ApplicationPhysicalPath, "App_Data\\Logs")); var ioHelper = new IOHelper(hostingEnvironment); - var logger = SerilogLogger.CreateWithDefaultConfiguration(hostingEnvironment, loggingConfiguration); + var logger = SerilogLogger.CreateWithDefaultConfiguration(hostingEnvironment, loggingConfiguration, new ConfigurationRoot(new List())); var configs = configFactory.Create();