more cleanup of system dirs
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -196,3 +196,4 @@ src/Umbraco.Tests.Integration/umbraco/logs/
|
||||
src/Umbraco.Tests.Integration/Views/
|
||||
|
||||
src/Umbraco.Tests/TEMP/
|
||||
/src/Umbraco.Web.UI.NetCore/Umbraco/Data/*
|
||||
|
||||
@@ -4,12 +4,30 @@ namespace Umbraco.Core
|
||||
{
|
||||
public static class SystemDirectories
|
||||
{
|
||||
/// <summary>
|
||||
/// The aspnet bin folder
|
||||
/// </summary>
|
||||
public const string Bin = "~/bin";
|
||||
|
||||
// TODO: Shouldn't this exist underneath /Umbraco in the content root?
|
||||
public const string Config = "~/config";
|
||||
|
||||
public const string Data = "~/Umbraco/Data";
|
||||
/// <summary>
|
||||
/// The Umbraco folder that exists at the content root.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is not the same as the Umbraco web folder which is configurable for serving front-end files.
|
||||
/// </remarks>
|
||||
public const string Umbraco = "~/Umbraco";
|
||||
|
||||
/// <summary>
|
||||
/// The Umbraco data folder in the content root
|
||||
/// </summary>
|
||||
public const string Data = Umbraco + "/Data";
|
||||
|
||||
/// <summary>
|
||||
/// The Umbraco temp data folder in the content root
|
||||
/// </summary>
|
||||
public const string TempData = Data + "/TEMP";
|
||||
|
||||
public const string TempFileUploads = TempData + "/FileUploads";
|
||||
@@ -30,8 +48,10 @@ namespace Umbraco.Core
|
||||
|
||||
public const string Preview = Data + "/preview";
|
||||
|
||||
// TODO: This doesn't seem right?
|
||||
public const string LogFiles= "~/Logs";
|
||||
/// <summary>
|
||||
/// The default folder where Umbraco log files are stored
|
||||
/// </summary>
|
||||
public const string LogFiles = Umbraco + "/Logs";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
namespace Umbraco.Core.Logging
|
||||
namespace Umbraco.Core.Logging
|
||||
{
|
||||
|
||||
public interface ILoggingConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// The physical path where logs are stored
|
||||
/// Gets the physical path where logs are stored
|
||||
/// </summary>
|
||||
string LogDirectory { get; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Serilog;
|
||||
@@ -127,7 +127,7 @@ namespace Umbraco.Core.Logging.Serilog
|
||||
/// Outputs a CLEF format JSON log at /App_Data/Logs/
|
||||
/// </summary>
|
||||
/// <param name="logConfig">A Serilog LoggerConfiguration</param>
|
||||
/// <param name="loggingConfiguration"></param>
|
||||
/// <param name="loggingConfiguration">The logging configuration</param>
|
||||
/// <param name="minimumLevel">The log level you wish the JSON file to collect - default is Verbose (highest)</param>
|
||||
/// <param name="retainedFileCount">The number of days to keep log files. Default is set to null which means all logs are kept</param>
|
||||
public static LoggerConfiguration OutputDefaultJsonFile(
|
||||
@@ -135,13 +135,13 @@ namespace Umbraco.Core.Logging.Serilog
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
ILoggingConfiguration loggingConfiguration, LogEventLevel minimumLevel = LogEventLevel.Verbose, int? retainedFileCount = null)
|
||||
{
|
||||
//.clef format (Compact log event format, that can be imported into local SEQ & will make searching/filtering logs easier)
|
||||
//Ends with ..txt as Date is inserted before file extension substring
|
||||
// .clef format (Compact log event format, that can be imported into local SEQ & will make searching/filtering logs easier)
|
||||
// Ends with ..txt as Date is inserted before file extension substring
|
||||
logConfig.WriteTo.File(new CompactJsonFormatter(),
|
||||
Path.Combine(hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.LogFiles) ,$"UmbracoTraceLog.{Environment.MachineName}..json"),
|
||||
shared: true,
|
||||
rollingInterval: RollingInterval.Day, //Create a new JSON file every day
|
||||
retainedFileCountLimit: retainedFileCount, //Setting to null means we keep all files - default is 31 days
|
||||
rollingInterval: RollingInterval.Day, // Create a new JSON file every day
|
||||
retainedFileCountLimit: retainedFileCount, // Setting to null means we keep all files - default is 31 days
|
||||
restrictedToMinimumLevel: minimumLevel);
|
||||
|
||||
return logConfig;
|
||||
|
||||
@@ -53,13 +53,20 @@ namespace Umbraco.Core.DependencyInjection
|
||||
IConfiguration config)
|
||||
{
|
||||
if (services is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(services));
|
||||
}
|
||||
|
||||
if (config is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(config));
|
||||
}
|
||||
|
||||
var loggingConfig = new LoggingConfiguration(Path.Combine(webHostEnvironment.ContentRootPath, "umbraco", "logs"));
|
||||
IHostingEnvironment tempHostingEnvironment = GetTemporaryHostingEnvironment(webHostEnvironment, config);
|
||||
|
||||
var loggingDir = tempHostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.LogFiles);
|
||||
var loggingConfig = new LoggingConfiguration(loggingDir);
|
||||
|
||||
var tempHostingEnvironment = GetTemporaryHostingEnvironment(webHostEnvironment, config);
|
||||
services.AddLogger(tempHostingEnvironment, loggingConfig, config);
|
||||
|
||||
IHttpContextAccessor httpContextAccessor = new HttpContextAccessor();
|
||||
@@ -69,11 +76,11 @@ namespace Umbraco.Core.DependencyInjection
|
||||
var appCaches = AppCaches.Create(requestCache);
|
||||
services.AddUnique<AppCaches>(appCaches);
|
||||
|
||||
var profiler = GetWebProfiler(config);
|
||||
IProfiler profiler = GetWebProfiler(config);
|
||||
services.AddUnique<IProfiler>(profiler);
|
||||
|
||||
var loggerFactory = LoggerFactory.Create(cfg => cfg.AddSerilog(Log.Logger, false));
|
||||
var typeLoader = services.AddTypeLoader(Assembly.GetEntryAssembly(), webHostEnvironment, tempHostingEnvironment, loggerFactory, appCaches, config, profiler);
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(cfg => cfg.AddSerilog(Log.Logger, false));
|
||||
TypeLoader typeLoader = services.AddTypeLoader(Assembly.GetEntryAssembly(), webHostEnvironment, tempHostingEnvironment, loggerFactory, appCaches, config, profiler);
|
||||
|
||||
return new UmbracoBuilder(services, config, typeLoader, loggerFactory);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user