FIRST PASS - Updates Umbraco.Core project to not use the func overload & to use new message template instead
This commit is contained in:
@@ -111,15 +111,15 @@ namespace Umbraco.Core.Components
|
||||
catch (Exception e)
|
||||
{
|
||||
// in case of an error, force-dump everything to log
|
||||
_logger.Info<BootLoader>(() => GetComponentsReport(requirements));
|
||||
_logger.Error<BootLoader>("Failed to sort components.", e);
|
||||
_logger.Info<BootLoader>("Component Report:\r\n{ComponentReport}", GetComponentsReport(requirements));
|
||||
_logger.Error<BootLoader>("Failed to sort compontents.", e);
|
||||
throw;
|
||||
}
|
||||
|
||||
// bit verbose but should help for troubleshooting
|
||||
var text = "Ordered Components: " + Environment.NewLine + string.Join(Environment.NewLine, sortedComponentTypes) + Environment.NewLine;
|
||||
Console.WriteLine(text);
|
||||
_logger.Debug<BootLoader>(text);
|
||||
_logger.Debug<BootLoader>("Ordered Components: {SortedComponentTypes}", sortedComponentTypes);
|
||||
|
||||
return sortedComponentTypes;
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@ namespace Umbraco.Core.Composing
|
||||
if (--attempts == 0)
|
||||
throw;
|
||||
|
||||
_logger.Logger.Debug<TypeLoader>(() => $"Attempted to get filestream for file {path} failed, {attempts} attempts left, pausing for {pauseMilliseconds} milliseconds");
|
||||
_logger.Logger.Debug<TypeLoader>("Attempted to get filestream for file {Path} failed, {NumberOfAttempts} attempts left, pausing for {PauseMilliseconds} milliseconds", path, attempts, pauseMilliseconds);
|
||||
Thread.Sleep(pauseMilliseconds);
|
||||
}
|
||||
}
|
||||
@@ -645,7 +645,7 @@ namespace Umbraco.Core.Composing
|
||||
if (typeList != null)
|
||||
{
|
||||
// need to put some logging here to try to figure out why this is happening: http://issues.umbraco.org/issue/U4-3505
|
||||
_logger.Logger.Debug<TypeLoader>(() => $"Getting {GetName(baseType, attributeType)}: found a cached type list.");
|
||||
_logger.Logger.Debug<TypeLoader>("Getting {TypeName}: found a cached type list.", GetName(baseType, attributeType));
|
||||
return typeList.Types;
|
||||
}
|
||||
|
||||
@@ -676,7 +676,7 @@ namespace Umbraco.Core.Composing
|
||||
// so in this instance there will never be a result.
|
||||
if (cacheResult.Exception is CachedTypeNotFoundInFileException || cacheResult.Success == false)
|
||||
{
|
||||
_logger.Logger.Debug<TypeLoader>(() => $"Getting {GetName(baseType, attributeType)}: failed to load from cache file, must scan assemblies.");
|
||||
_logger.Logger.Debug<TypeLoader>("Getting {TypeName}: failed to load from cache file, must scan assemblies.", GetName(baseType, attributeType));
|
||||
scan = true;
|
||||
}
|
||||
else
|
||||
@@ -695,7 +695,7 @@ namespace Umbraco.Core.Composing
|
||||
catch (Exception ex)
|
||||
{
|
||||
// in case of any exception, we have to exit, and revert to scanning
|
||||
_logger.Logger.Error<TypeLoader>("Getting " + GetName(baseType, attributeType) + ": failed to load cache file type " + type + ", reverting to scanning assemblies.", ex);
|
||||
_logger.Logger.Error<TypeLoader>("Getting {TypeName}: failed to load cache file type {CacheType}, reverting to scanning assemblies.", ex, GetName(baseType, attributeType), type);
|
||||
scan = true;
|
||||
break;
|
||||
}
|
||||
@@ -703,7 +703,7 @@ namespace Umbraco.Core.Composing
|
||||
|
||||
if (scan == false)
|
||||
{
|
||||
_logger.Logger.Debug<TypeLoader>(() => $"Getting {GetName(baseType, attributeType)}: loaded types from cache file.");
|
||||
_logger.Logger.Debug<TypeLoader>("Getting {TypeName}: loaded types from cache file.", GetName(baseType, attributeType));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -711,7 +711,7 @@ namespace Umbraco.Core.Composing
|
||||
if (scan)
|
||||
{
|
||||
// either we had to scan, or we could not get the types from the cache file - scan now
|
||||
_logger.Logger.Debug<TypeLoader>(() => $"Getting {GetName(baseType, attributeType)}: scanning assemblies.");
|
||||
_logger.Logger.Debug<TypeLoader>("Getting {TypeName}: scanning assemblies.", GetName(baseType, attributeType));
|
||||
|
||||
foreach (var t in finder())
|
||||
typeList.Add(t);
|
||||
@@ -729,11 +729,11 @@ namespace Umbraco.Core.Composing
|
||||
UpdateCache();
|
||||
}
|
||||
|
||||
_logger.Logger.Debug<TypeLoader>(() => $"Got {GetName(baseType, attributeType)}, caching ({added.ToString().ToLowerInvariant()}).");
|
||||
_logger.Logger.Debug<TypeLoader>("Got {TypeName}, caching ({CacheType}).", GetName(baseType, attributeType), added.ToString().ToLowerInvariant());
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Logger.Debug<TypeLoader>(() => $"Got {GetName(baseType, attributeType)}.");
|
||||
_logger.Logger.Debug<TypeLoader>("Got {TypeName}.", GetName(baseType, attributeType));
|
||||
}
|
||||
|
||||
return typeList.Types;
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Umbraco.Core.Configuration
|
||||
versionAttribute.SetValue(newVersion);
|
||||
clientDependencyConfigXml.Save(_fileName, SaveOptions.DisableFormatting);
|
||||
|
||||
_logger.Info<ClientDependencyConfiguration>(() => $"Updated version number from {oldVersion} to {newVersion}");
|
||||
_logger.Info<ClientDependencyConfiguration>("Updated version number from {OldVersion} to {NewVersion}", oldVersion, newVersion);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ namespace Umbraco.Core.Configuration
|
||||
versionAttribute.SetValue(newVersion);
|
||||
clientDependencyConfigXml.Save(_fileName, SaveOptions.DisableFormatting);
|
||||
|
||||
_logger.Info<ClientDependencyConfiguration>(() => $"Updated version number from {oldVersion} to {newVersion}");
|
||||
_logger.Info<ClientDependencyConfiguration>("Updated version number from {OldVersion} to {NewVersion}", oldVersion, newVersion);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace Umbraco.Core.IO
|
||||
}
|
||||
catch (FileNotFoundException ex)
|
||||
{
|
||||
Current.Logger.Info<PhysicalFileSystem>(() => $"DeleteFile failed with FileNotFoundException: {ex.InnerException}");
|
||||
Current.Logger.Error<PhysicalFileSystem>("DeleteFile failed with FileNotFoundException for '{Path}'", ex.InnerException, fullPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Umbraco.Core.IO
|
||||
}
|
||||
|
||||
_logger = logger;
|
||||
_logger.Debug<ShadowFileSystems>(() => "Shadow " + id + ".");
|
||||
_logger.Debug<ShadowFileSystems>("Shadow '{ShadowId}'", id);
|
||||
_id = id;
|
||||
|
||||
_wrappers = wrappers;
|
||||
@@ -112,7 +112,7 @@ namespace Umbraco.Core.IO
|
||||
{
|
||||
lock (Locker)
|
||||
{
|
||||
_logger.Debug<ShadowFileSystems>(() => "UnShadow " + _id + " (" + (_completed ? "complete" : "abort") + ").");
|
||||
_logger.Debug<ShadowFileSystems>("UnShadow '{ShadowId}' {Status}", _id, _completed ? "complete" : "abort");
|
||||
|
||||
var exceptions = new List<Exception>();
|
||||
foreach (var wrapper in _wrappers)
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace Umbraco.Core.Logging
|
||||
/// <inheritdoc/>
|
||||
public IDisposable Step(string name)
|
||||
{
|
||||
_logger.Debug<LogProfiler>(() => $"Begin: {name}.");
|
||||
return new LightDisposableTimer(duration => _logger.Info<LogProfiler>(() => $"End {name}. ({duration}ms)"));
|
||||
_logger.Debug<LogProfiler>("Begin: {ProfileName}", name);
|
||||
return new LightDisposableTimer(duration => _logger.Info<LogProfiler>("End {ProfileName} ({ProfileDuration}ms)", name, duration));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace Umbraco.Core
|
||||
|
||||
lock (_locko)
|
||||
{
|
||||
_logger.Debug<MainDom>(() => "Signaled" + (_signaled ? " (again)" : "") + " (" + source + ").");
|
||||
_logger.Debug<MainDom>("Signaled {Signaled} ({SignalSource})", _signaled ? "(again)" : string.Empty, source);
|
||||
if (_signaled) return;
|
||||
if (_isMainDom == false) return; // probably not needed
|
||||
_signaled = true;
|
||||
@@ -125,7 +125,7 @@ namespace Umbraco.Core
|
||||
|
||||
try
|
||||
{
|
||||
_logger.Info<MainDom>("Stopping.");
|
||||
_logger.Info<MainDom>("Stopping ({SignalSource})", source);
|
||||
foreach (var callback in _callbacks.OrderBy(x => x.Key).Select(x => x.Value))
|
||||
{
|
||||
try
|
||||
@@ -139,14 +139,14 @@ namespace Umbraco.Core
|
||||
}
|
||||
|
||||
}
|
||||
_logger.Debug<MainDom>("Stopped.");
|
||||
_logger.Debug<MainDom>("Stopped ({SignalSource})", source);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// in any case...
|
||||
_isMainDom = false;
|
||||
_asyncLocker.Dispose();
|
||||
_logger.Info<MainDom>("Released.");
|
||||
_logger.Info<MainDom>("Released ({SignalSource})", source);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
{
|
||||
var source = connectionStrings.Attribute("configSource").Value;
|
||||
var configFile = IOHelper.MapPath($"{SystemDirectories.Root}/{source}");
|
||||
logger.Info<DatabaseBuilder>(() => $"Storing ConnectionString in {configFile}");
|
||||
logger.Info<DatabaseBuilder>("Storing ConnectionString in {ConfigFile}", configFile);
|
||||
if (File.Exists(configFile))
|
||||
{
|
||||
xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace);
|
||||
@@ -335,7 +335,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
}
|
||||
|
||||
xml.Save(fileName, SaveOptions.DisableFormatting);
|
||||
logger.Info<DatabaseBuilder>(() => $"Configured a new ConnectionString using the '{providerName}' provider.");
|
||||
logger.Info<DatabaseBuilder>("Configured a new ConnectionString using the '{ProviderName}' provider.", providerName);
|
||||
}
|
||||
|
||||
internal bool IsConnectionStringConfigured(ConnectionStringSettings databaseSettings)
|
||||
@@ -500,7 +500,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
message = message + "<p>Installation completed!</p>";
|
||||
|
||||
//now that everything is done, we need to determine the version of SQL server that is executing
|
||||
_logger.Info<DatabaseBuilder>(() => $"Database configuration status: {message}");
|
||||
_logger.Info<DatabaseBuilder>("Database configuration status: {DbConfigStatus}", message);
|
||||
return new Result { Message = message, Success = true, Percentage = "100" };
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
|
||||
//now that everything is done, we need to determine the version of SQL server that is executing
|
||||
|
||||
_logger.Info<DatabaseBuilder>(() => $"Database configuration status: {message}");
|
||||
_logger.Info<DatabaseBuilder>("Database configuration status: {DbConfigStatus}", message);
|
||||
|
||||
return new Result { Message = message, Success = true, Percentage = "100" };
|
||||
}
|
||||
@@ -662,7 +662,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
|
||||
if (_databaseSchemaValidationResult != null)
|
||||
{
|
||||
_logger.Info<DatabaseBuilder>(() => $"The database schema validation produced the following summary: {Environment.NewLine}{_databaseSchemaValidationResult.GetSummary()}");
|
||||
_logger.Info<DatabaseBuilder>("The database schema validation produced the following summary: {DbSchemaSummary}", _databaseSchemaValidationResult.GetSummary());
|
||||
}
|
||||
|
||||
return new Result
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
/// <param name="tableName">Name of the table to create base data for</param>
|
||||
public void InitializeBaseData(string tableName)
|
||||
{
|
||||
_logger.Info<DatabaseDataCreator>(() => $"Creating data in table {tableName}");
|
||||
_logger.Info<DatabaseDataCreator>("Creating data in {TableName}", tableName);
|
||||
|
||||
if (tableName.Equals(Constants.DatabaseSchema.Tables.Node))
|
||||
CreateNodeData();
|
||||
@@ -76,7 +76,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
if (tableName.Equals(Constants.DatabaseSchema.Tables.KeyValue))
|
||||
CreateKeyValueData();
|
||||
|
||||
_logger.Info<DatabaseDataCreator>(() => $"Done creating table {tableName} data.");
|
||||
_logger.Info<DatabaseDataCreator>("Done creating table {TableName} data.", tableName);
|
||||
}
|
||||
|
||||
private void CreateNodeData()
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
var tableNameAttribute = table.FirstAttribute<TableNameAttribute>();
|
||||
var tableName = tableNameAttribute == null ? table.Name : tableNameAttribute.Value;
|
||||
|
||||
_logger.Info<DatabaseSchemaCreator>(() => $"Uninstall {tableName}");
|
||||
_logger.Info<DatabaseSchemaCreator>("Uninstall {TableName}", tableName);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -392,13 +392,13 @@ namespace Umbraco.Core.Migrations.Install
|
||||
{
|
||||
//Execute the Create Table sql
|
||||
var created = _database.Execute(new Sql(createSql));
|
||||
_logger.Info<DatabaseSchemaCreator>(() => $"Create Table '{tableName}' ({created}):\n {createSql}");
|
||||
_logger.Info<DatabaseSchemaCreator>("Create Table '{TableName}' ({Created}): \n {Sql}", tableName, created, createSql);
|
||||
|
||||
//If any statements exists for the primary key execute them here
|
||||
if (string.IsNullOrEmpty(createPrimaryKeySql) == false)
|
||||
{
|
||||
var createdPk = _database.Execute(new Sql(createPrimaryKeySql));
|
||||
_logger.Info<DatabaseSchemaCreator>(() => $"Create Primary Key ({createdPk}):\n {createPrimaryKeySql}");
|
||||
_logger.Info<DatabaseSchemaCreator>("Create Primary Key ({CreatedPk}):\n {Sql}", createdPk, createPrimaryKeySql);
|
||||
}
|
||||
|
||||
//Turn on identity insert if db provider is not mysql
|
||||
@@ -424,21 +424,21 @@ namespace Umbraco.Core.Migrations.Install
|
||||
foreach (var sql in indexSql)
|
||||
{
|
||||
var createdIndex = _database.Execute(new Sql(sql));
|
||||
_logger.Info<DatabaseSchemaCreator>(() => $"Create Index ({createdIndex}):\n {sql}");
|
||||
_logger.Info<DatabaseSchemaCreator>("Create Index ({CreatedIndex}):\n {Sql}", createdIndex, sql);
|
||||
}
|
||||
|
||||
//Loop through foreignkey statements and execute sql
|
||||
foreach (var sql in foreignSql)
|
||||
{
|
||||
var createdFk = _database.Execute(new Sql(sql));
|
||||
_logger.Info<DatabaseSchemaCreator>(() => $"Create Foreign Key ({createdFk}):\n {sql}");
|
||||
_logger.Info<DatabaseSchemaCreator>("Create Foreign Key ({CreatedFk}):\n {Sql}", createdFk, sql);
|
||||
}
|
||||
|
||||
transaction.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
_logger.Info<DatabaseSchemaCreator>(() => $"Created table '{tableName}'");
|
||||
_logger.Info<DatabaseSchemaCreator>("Created table '{TableName}'", tableName);
|
||||
}
|
||||
|
||||
public void DropTable(string tableName)
|
||||
|
||||
@@ -269,14 +269,11 @@ namespace Umbraco.Core.Migrations
|
||||
if (_migrationBuilder == null || _logger == null)
|
||||
throw new InvalidOperationException("Cannot execute a non-executing plan.");
|
||||
|
||||
_logger.Info<MigrationPlan>(() => $"Starting \"{Name}\"...");
|
||||
_logger.Info<MigrationPlan>("Starting '{MigrationName}'...", Name);
|
||||
|
||||
var origState = fromState ?? string.Empty;
|
||||
|
||||
_logger.Info<MigrationPlan>(() =>
|
||||
{
|
||||
var info = "At " + (string.IsNullOrWhiteSpace(origState) ? "origin" : ("\"" + origState + "\"")) + ".";
|
||||
return info.Replace("{", "{{").Replace("}", "}}"); // stupid log4net
|
||||
});
|
||||
_logger.Info<MigrationPlan>("At {OrigState}", string.IsNullOrWhiteSpace(origState) ? "origin": origState);
|
||||
|
||||
if (!_transitions.TryGetValue(origState, out var transition))
|
||||
throw new Exception($"Unknown state \"{origState}\".");
|
||||
@@ -291,7 +288,7 @@ namespace Umbraco.Core.Migrations
|
||||
var nextState = transition.TargetState;
|
||||
origState = nextState;
|
||||
|
||||
_logger.Info<MigrationPlan>(() => $"At \"{origState}\".");
|
||||
_logger.Info<MigrationPlan>("At {OrigState}", origState);
|
||||
|
||||
if (!_transitions.TryGetValue(origState, out transition))
|
||||
throw new Exception($"Unknown state \"{origState}\".");
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
|
||||
var keyName = c.Item3.ToLowerInvariant();
|
||||
if (dups.Contains(keyName))
|
||||
{
|
||||
Logger.Warn<RefactorXmlColumns>(() => $"Duplicate constraint {c.Item3}");
|
||||
Logger.Warn<RefactorXmlColumns>("Duplicate constraint '{Constraint}'", c.Item3);
|
||||
continue;
|
||||
}
|
||||
dups.Add(keyName);
|
||||
|
||||
@@ -561,7 +561,7 @@ AND umbracoNode.id <> @id",
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Warn<ContentTypeRepositoryBase<TEntity>>(() => $"Could not assign a data type for the property type {propertyType.Alias} since no data type was found with a property editor {propertyType.PropertyEditorAlias}");
|
||||
Logger.Warn<ContentTypeRepositoryBase<TEntity>>("Could not assign a data type for the property type {PropertyTypeAlias} since no data type was found with a property editor {PropertyEditorAlias}", propertyType.Alias, propertyType.PropertyEditorAlias);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,9 +193,9 @@ namespace Umbraco.Core.Persistence
|
||||
protected override void OnException(Exception x)
|
||||
{
|
||||
_logger.Error<UmbracoDatabase>("Exception (" + InstanceId + ").", x);
|
||||
_logger.Debug<UmbracoDatabase>(() => "At:\r\n" + Environment.StackTrace);
|
||||
_logger.Debug<UmbracoDatabase>("At:\r\n{StackTrace}", Environment.StackTrace);
|
||||
if (EnableSqlTrace == false)
|
||||
_logger.Debug<UmbracoDatabase>(() => "Sql:\r\n" + CommandToString(LastSQL, LastArgs));
|
||||
_logger.Debug<UmbracoDatabase>("Sql:\r\n{Sql}", CommandToString(LastSQL, LastArgs));
|
||||
base.OnException(x);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace Umbraco.Core.Persistence
|
||||
cmd.CommandTimeout = cmd.Connection.ConnectionTimeout;
|
||||
|
||||
if (EnableSqlTrace)
|
||||
_logger.Debug<UmbracoDatabase>(() => CommandToString(cmd).Replace("{", "{{").Replace("}", "}}")); // fixme these escapes should be builtin
|
||||
_logger.Debug<UmbracoDatabase>("SQL Trace:\r\n{Sql}", CommandToString(cmd).Replace("{", "{{").Replace("}", "}}")); // fixme these escapes should be builtin
|
||||
|
||||
#if DEBUG_DATABASES
|
||||
// detects whether the command is already in use (eg still has an open reader...)
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace Umbraco.Core.PropertyEditors
|
||||
var result = TryConvertValueToCrlType(editorValue.Value);
|
||||
if (result.Success == false)
|
||||
{
|
||||
Current.Logger.Warn<DataValueEditor>(() => $"The value {editorValue.Value} cannot be converted to the type {ValueTypes.ToStorageType(ValueType)}");
|
||||
Current.Logger.Warn<DataValueEditor>("The value {EditorValue} cannot be converted to the type {StorageTypeValue}", editorValue.Value, ValueTypes.ToStorageType(ValueType));
|
||||
return null;
|
||||
}
|
||||
return result.Result;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Umbraco.Core.Publishing
|
||||
var counter = 0;
|
||||
var contentForRelease = _contentService.GetContentForRelease().ToArray();
|
||||
if (contentForRelease.Length > 0)
|
||||
_logger.Debug<ScheduledPublisher>(() => $"There's {contentForRelease.Length} item(s) of content to be published");
|
||||
_logger.Debug<ScheduledPublisher>("There's {ContentItemsForRelease} item(s) of content to be published", contentForRelease.Length);
|
||||
foreach (var d in contentForRelease)
|
||||
{
|
||||
try
|
||||
@@ -43,10 +43,10 @@ namespace Umbraco.Core.Publishing
|
||||
d.ReleaseDate = null;
|
||||
d.PublishCulture(); // fixme variants?
|
||||
var result = _contentService.SaveAndPublish(d, userId: _userService.GetProfileById(d.WriterId).Id);
|
||||
_logger.Debug<ContentService>(() => $"Result of publish attempt: {result.Result}");
|
||||
_logger.Debug<ContentService>("Result of publish attempt: {PublishResult}", result.Result);
|
||||
if (result.Success == false)
|
||||
{
|
||||
_logger.Error<ScheduledPublisher>($"Error publishing node {d.Id}");
|
||||
_logger.Error<ScheduledPublisher>("Error publishing node {NodeId}", null, d.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -55,14 +55,14 @@ namespace Umbraco.Core.Publishing
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
_logger.Error<ScheduledPublisher>($"Error publishing node {d.Id}", ee);
|
||||
_logger.Error<ScheduledPublisher>("Error publishing node {NodeId}", ee, d.Id);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
var contentForExpiration = _contentService.GetContentForExpiration().ToArray();
|
||||
if (contentForExpiration.Length > 0)
|
||||
_logger.Debug<ScheduledPublisher>(() => $"There's {contentForExpiration.Length} item(s) of content to be unpublished");
|
||||
_logger.Debug<ScheduledPublisher>("There's {ContentItemsForExpiration} item(s) of content to be unpublished", contentForExpiration.Length);
|
||||
foreach (var d in contentForExpiration)
|
||||
{
|
||||
try
|
||||
@@ -76,7 +76,7 @@ namespace Umbraco.Core.Publishing
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
_logger.Error<ScheduledPublisher>($"Error unpublishing node {d.Id}", ee);
|
||||
_logger.Error<ScheduledPublisher>("Error unpublishing node {NodeId}", ee, d.Id);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Umbraco.Core.Runtime
|
||||
|
||||
try
|
||||
{
|
||||
Logger.Debug<CoreRuntime>(() => $"Runtime: {GetType().FullName}");
|
||||
Logger.Debug<CoreRuntime>("Runtime: {Runtime}", GetType().FullName);
|
||||
|
||||
AquireMainDom(container);
|
||||
DetermineRuntimeLevel(container);
|
||||
@@ -141,11 +141,11 @@ namespace Umbraco.Core.Runtime
|
||||
var dbfactory = container.GetInstance<IUmbracoDatabaseFactory>();
|
||||
SetRuntimeStateLevel(dbfactory, Logger);
|
||||
|
||||
Logger.Debug<CoreRuntime>(() => $"Runtime level: {_state.Level}");
|
||||
Logger.Debug<CoreRuntime>("Runtime level: {RuntimeLevel}", _state.Level);
|
||||
|
||||
if (_state.Level == RuntimeLevel.Upgrade)
|
||||
{
|
||||
Logger.Debug<CoreRuntime>(() => $"Configure database factory for upgrades.");
|
||||
Logger.Debug<CoreRuntime>("Configure database factory for upgrades.");
|
||||
dbfactory.ConfigureForUpgrade();
|
||||
}
|
||||
}
|
||||
@@ -262,12 +262,12 @@ namespace Umbraco.Core.Runtime
|
||||
{
|
||||
// there *is* a local version, but it does not match the code version
|
||||
// need to upgrade
|
||||
logger.Debug<CoreRuntime>(() => $"Local version \"{localVersion}\" < code version \"{codeVersion}\", need to upgrade Umbraco.");
|
||||
logger.Debug<CoreRuntime>("Local version '{LocalVersion}' < code version '{CodeVersion}', need to upgrade Umbraco.", localVersion, codeVersion);
|
||||
_state.Level = RuntimeLevel.Upgrade;
|
||||
}
|
||||
else if (localVersion > codeVersion)
|
||||
{
|
||||
logger.Warn<CoreRuntime>(() => $"Local version \"{localVersion}\" > code version \"{codeVersion}\", downgrading is not supported.");
|
||||
logger.Warn<CoreRuntime>("Local version '{LocalVersion}' > code version '{CodeVersion}', downgrading is not supported.", localVersion, codeVersion);
|
||||
_state.Level = RuntimeLevel.BootFailed;
|
||||
|
||||
// in fact, this is bad enough that we want to throw
|
||||
@@ -292,16 +292,14 @@ namespace Umbraco.Core.Runtime
|
||||
{
|
||||
connect = databaseFactory.CanConnect;
|
||||
if (connect) break;
|
||||
logger.Debug<CoreRuntime>(() => i == 0
|
||||
? "Could not immediately connect to database, trying again."
|
||||
: "Could not connect to database.");
|
||||
logger.Debug<CoreRuntime>("Could not immediately connect to database, trying again.");
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
if (connect == false)
|
||||
{
|
||||
// cannot connect to configured database, this is bad, fail
|
||||
logger.Debug<CoreRuntime>(() => "Could not connect to database.");
|
||||
logger.Debug<CoreRuntime>("Could not connect to database.");
|
||||
_state.Level = RuntimeLevel.BootFailed;
|
||||
|
||||
// in fact, this is bad enough that we want to throw
|
||||
@@ -365,7 +363,7 @@ namespace Umbraco.Core.Runtime
|
||||
_state.CurrentMigrationState = state;
|
||||
_state.FinalMigrationState = umbracoPlan.FinalState;
|
||||
|
||||
logger.Debug<CoreRuntime>(() => $"Final upgrade state is \"{_state.FinalMigrationState}\", database contains \"{state ?? "<null>"}\".");
|
||||
logger.Debug<CoreRuntime>("Final upgrade state is '{FinalMigrationState}', database contains {DatabaseState}", _state.FinalMigrationState, state ?? "<null>");
|
||||
|
||||
return state == _state.FinalMigrationState;
|
||||
}
|
||||
|
||||
@@ -318,7 +318,8 @@ namespace Umbraco.Core.Scoping
|
||||
if (completed.HasValue == false || completed.Value == false)
|
||||
{
|
||||
if (LogUncompletedScopes)
|
||||
_logger.Debug<Scope>(() => "Uncompleted Child Scope at\r\n" + Environment.StackTrace);
|
||||
_logger.Debug<Scope>("Uncompleted Child Scope at\r\n {StackTrace}", Environment.StackTrace);
|
||||
|
||||
_completed = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace Umbraco.Core.Scoping
|
||||
}
|
||||
|
||||
// hard to inject into a static method :(
|
||||
Current.Logger.Warn<ScopeProvider>(() => $"Missed {typeof(T).Name} Object {objectKey.ToString("N").Substring(0, 8)}");
|
||||
Current.Logger.Warn<ScopeProvider>("Missed {TypeName} Object {ObjectKey}", typeof(T).Name, objectKey.ToString("N").Substring(0, 8));
|
||||
#if DEBUG_SCOPES
|
||||
//Current.Logger.Debug<ScopeProvider>("At:\r\n" + Head(Environment.StackTrace, 24));
|
||||
#endif
|
||||
|
||||
@@ -2178,7 +2178,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
// raise Publishing event
|
||||
if (scope.Events.DispatchCancelable(Publishing, this, new PublishEventArgs<IContent>(content, evtMsgs)))
|
||||
{
|
||||
Logger.Info<ContentService>(() => $"Document \"'{content.Name}\" (id={content.Id}) cannot be published: publishing was cancelled.");
|
||||
Logger.Info<ContentService>("Document '{ContentName}' (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "publishing was cancelled");
|
||||
return new PublishResult(PublishResultType.FailedCancelledByEvent, evtMsgs, content);
|
||||
}
|
||||
|
||||
@@ -2186,7 +2186,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
// either because it is 'publishing' or because it already has a published version
|
||||
if (((Content) content).PublishedState != PublishedState.Publishing && content.PublishedVersionId == 0)
|
||||
{
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) cannot be published: document does not have published values.");
|
||||
Logger.Info<ContentService>("Document '{ContentName}' (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document does not have published values");
|
||||
return new PublishResult(PublishResultType.FailedNoPublishedValues, evtMsgs, content);
|
||||
}
|
||||
|
||||
@@ -2194,15 +2194,15 @@ namespace Umbraco.Core.Services.Implement
|
||||
switch (content.Status)
|
||||
{
|
||||
case ContentStatus.Expired:
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) cannot be published: document has expired.");
|
||||
Logger.Info<ContentService>("Document '{ContentName}' (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document has expired");
|
||||
return new PublishResult(PublishResultType.FailedHasExpired, evtMsgs, content);
|
||||
|
||||
case ContentStatus.AwaitingRelease:
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) cannot be published: document is awaiting release.");
|
||||
Logger.Info<ContentService>("Document '{ContentName}' (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document is awaiting release");
|
||||
return new PublishResult(PublishResultType.FailedAwaitingRelease, evtMsgs, content);
|
||||
|
||||
case ContentStatus.Trashed:
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) cannot be published: document is trashed.");
|
||||
Logger.Info<ContentService>("Document '{ContentName}' (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document is trashed");
|
||||
return new PublishResult(PublishResultType.FailedIsTrashed, evtMsgs, content);
|
||||
}
|
||||
|
||||
@@ -2214,7 +2214,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
var pathIsOk = content.ParentId == Constants.System.Root || IsPathPublished(GetParent(content));
|
||||
if (pathIsOk == false)
|
||||
{
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) cannot be published: parent is not published.");
|
||||
Logger.Info<ContentService>("Document '{ContentName}' (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "parent is not published");
|
||||
return new PublishResult(PublishResultType.FailedPathNotPublished, evtMsgs, content);
|
||||
}
|
||||
|
||||
@@ -2238,7 +2238,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
// change state to publishing
|
||||
((Content) content).PublishedState = PublishedState.Publishing;
|
||||
|
||||
Logger.Info<ContentService>(() => $"Content \"{content.Name}\" (id={content.Id}) has been published.");
|
||||
Logger.Info<ContentService>("Document '{ContentName}' (id={ContentId}) has been published.", content.Name, content.Id);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2248,7 +2248,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
// raise UnPublishing event
|
||||
if (scope.Events.DispatchCancelable(UnPublishing, this, new PublishEventArgs<IContent>(content, evtMsgs)))
|
||||
{
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) cannot be unpublished: unpublishing was cancelled.");
|
||||
Logger.Info<ContentService>("Document '{ContentName}' (id={ContentId}) cannot be unpublished: unpublishing was cancelled.", content.Name, content.Id);
|
||||
return new UnpublishResult(UnpublishResultType.FailedCancelledByEvent, evtMsgs, content);
|
||||
}
|
||||
|
||||
@@ -2271,13 +2271,13 @@ namespace Umbraco.Core.Services.Implement
|
||||
if (content.ReleaseDate.HasValue && content.ReleaseDate.Value <= DateTime.Now)
|
||||
{
|
||||
content.ReleaseDate = null;
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) had its release date removed, because it was unpublished.");
|
||||
Logger.Info<ContentService>("Document '{ContentName}' (id={ContentId}) had its release date removed, because it was unpublished.", content.Name, content.Id);
|
||||
}
|
||||
|
||||
// change state to unpublishing
|
||||
((Content) content).PublishedState = PublishedState.Unpublishing;
|
||||
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) has been unpublished.");
|
||||
Logger.Info<ContentService>("Document '{ContentName}' (id={ContentId}) has been unpublished.", content.Name, content.Id);
|
||||
return attempt;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
{
|
||||
if (xmlSource.ContainsKey(culture) == false)
|
||||
{
|
||||
_logger.Warn<LocalizedTextService>(() => $"The culture specified {culture} was not found in any configured sources for this service");
|
||||
_logger.Warn<LocalizedTextService>("The culture specified {Culture} was not found in any configured sources for this service", culture);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
{
|
||||
if (_dictionarySource.ContainsKey(culture) == false)
|
||||
{
|
||||
_logger.Warn<LocalizedTextService>(() => $"The culture specified {culture} was not found in any configured sources for this service");
|
||||
_logger.Warn<LocalizedTextService>("The culture specified {Culture} was not found in any configured sources for this service", culture);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
{
|
||||
if (_dictionarySource.ContainsKey(culture) == false)
|
||||
{
|
||||
_logger.Warn<LocalizedTextService>(() => $"The culture specified {culture} was not found in any configured sources for this service");
|
||||
_logger.Warn<LocalizedTextService>("The culture specified {Culture} was not found in any configured sources for this service", culture);
|
||||
return "[" + key + "]";
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
{
|
||||
if (xmlSource.ContainsKey(culture) == false)
|
||||
{
|
||||
_logger.Warn<LocalizedTextService>(() => $"The culture specified {culture} was not found in any configured sources for this service");
|
||||
_logger.Warn<LocalizedTextService>("The culture specified {Culture} was not found in any configured sources for this service", culture);
|
||||
return "[" + key + "]";
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
}
|
||||
catch (CultureNotFoundException)
|
||||
{
|
||||
Current.Logger.Warn<LocalizedTextServiceFileSources>(() => $"The culture {cultureVal} found in the file {fileInfo.FullName} is not a valid culture");
|
||||
Current.Logger.Warn<LocalizedTextServiceFileSources>("The culture {CultureValue} found in the file {CultureFile} is not a valid culture", cultureVal, fileInfo.FullName);
|
||||
//If the culture in the file is invalid, we'll just hope the file name is a valid culture below, otherwise
|
||||
// an exception will be thrown.
|
||||
}
|
||||
@@ -125,7 +125,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
|
||||
if (fileSourceFolder.Exists == false)
|
||||
{
|
||||
Current.Logger.Warn<LocalizedTextServiceFileSources>(() => $"The folder does not exist: {fileSourceFolder.FullName}, therefore no sources will be discovered");
|
||||
Current.Logger.Warn<LocalizedTextServiceFileSources>("The folder does not exist: {FileSourceFolder}, therefore no sources will be discovered", fileSourceFolder.FullName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -629,7 +629,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
try
|
||||
{
|
||||
if (Sendmail != null) Sendmail(s, request.Mail, _logger); else s.Send(request.Mail);
|
||||
_logger.Debug<NotificationService>(() => string.Format("Notification \"{0}\" sent to {1} ({2})", request.Action, request.UserName, request.Email));
|
||||
_logger.Debug<NotificationService>("Notification '{Action}' sent to {Username} ({Email})", request.Action, request.UserName, request.Email);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -631,7 +631,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Warn<PackagingService>(() => $"Packager: Error handling allowed templates. Template with alias '{alias}' could not be found.");
|
||||
_logger.Warn<PackagingService>("Packager: Error handling allowed templates. Template with alias '{TemplateAlias}' could not be found.", alias);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -647,7 +647,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Warn<PackagingService>(() => $"Packager: Error handling default template. Default template with alias '{defaultTemplateElement.Value}' could not be found.");
|
||||
_logger.Warn<PackagingService>("Packager: Error handling default template. Default template with alias '{DefaultTemplateAlias}' could not be found.", defaultTemplateElement.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -718,7 +718,8 @@ namespace Umbraco.Core.Services.Implement
|
||||
// This means that the property will not be created.
|
||||
if (dataTypeDefinition == null)
|
||||
{
|
||||
_logger.Warn<PackagingService>(() => $"Packager: Error handling creation of PropertyType '{property.Element("Name").Value}'. Could not find DataTypeDefintion with unique id '{dataTypeDefinitionId}' nor one referencing the DataType with a property editor alias (or legacy control id) '{property.Element("Type").Value.Trim()}'. Did the package creator forget to package up custom datatypes? This property will be converted to a label/readonly editor if one exists.");
|
||||
_logger.Warn<PackagingService>("Packager: Error handling creation of PropertyType '{PropertyType}'. Could not find DataTypeDefintion with unique id '{DataTypeDefinitionId}' nor one referencing the DataType with a property editor alias (or legacy control id) '{PropertyEditorAlias}'. Did the package creator forget to package up custom datatypes? This property will be converted to a label/readonly editor if one exists.",
|
||||
property.Element("Name").Value, dataTypeDefinitionId, property.Element("Type").Value.Trim());
|
||||
|
||||
//convert to a label!
|
||||
dataTypeDefinition = _dataTypeService.GetByEditorAlias(Constants.PropertyEditors.Aliases.NoEdit).FirstOrDefault();
|
||||
@@ -762,7 +763,9 @@ namespace Umbraco.Core.Services.Implement
|
||||
var allowedChild = _importedContentTypes.ContainsKey(alias) ? _importedContentTypes[alias] : _contentTypeService.Get(alias);
|
||||
if (allowedChild == null)
|
||||
{
|
||||
_logger.Warn<PackagingService>(() => $"Packager: Error handling DocumentType structure. DocumentType with alias '{alias}' could not be found and was not added to the structure for '{contentType.Alias}'.");
|
||||
_logger.Warn<PackagingService>(
|
||||
"Packager: Error handling DocumentType structure. DocumentType with alias '{DoctypeAlias}' could not be found and was not added to the structure for '{DoctypeStructureAlias}'.",
|
||||
alias, contentType.Alias);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -192,9 +192,11 @@ namespace Umbraco.Core.Sync
|
||||
if (count > Options.MaxProcessingInstructionCount)
|
||||
{
|
||||
//too many instructions, proceed to cold boot
|
||||
Logger.Warn<DatabaseServerMessenger>(() => $"The instruction count ({count}) exceeds the specified MaxProcessingInstructionCount ({Options.MaxProcessingInstructionCount})."
|
||||
Logger.Warn<DatabaseServerMessenger>(
|
||||
"The instruction count ({InstructionCount}) exceeds the specified MaxProcessingInstructionCount ({MaxProcessingInstructionCount})."
|
||||
+ " The server will skip existing instructions, rebuild its caches and indexes entirely, adjust its last synced Id"
|
||||
+ " to the latest found in the database and maintain cache updates based on that Id.");
|
||||
+ " to the latest found in the database and maintain cache updates based on that Id.",
|
||||
count, Options.MaxProcessingInstructionCount);
|
||||
|
||||
coldboot = true;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Umbraco.Core.Sync
|
||||
{
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
|
||||
Current.Logger.Debug<ServerMessengerBase>(() => $"Invoking refresher {refresher.GetType()} on local server for message type RefreshByPayload");
|
||||
Current.Logger.Debug<ServerMessengerBase>("Invoking refresher {RefresherType} on local server for message type RefreshByPayload", refresher.GetType());
|
||||
|
||||
var payloadRefresher = refresher as IPayloadCacheRefresher<TPayload>;
|
||||
if (payloadRefresher == null)
|
||||
@@ -179,7 +179,7 @@ namespace Umbraco.Core.Sync
|
||||
{
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
|
||||
Current.Logger.Debug<ServerMessengerBase>(() => $"Invoking refresher {refresher.GetType()} on local server for message type {messageType}");
|
||||
Current.Logger.Debug<ServerMessengerBase>("Invoking refresher {RefresherType} on local server for message type {MessageType}", refresher.GetType(), messageType);
|
||||
|
||||
switch (messageType)
|
||||
{
|
||||
@@ -240,7 +240,7 @@ namespace Umbraco.Core.Sync
|
||||
{
|
||||
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
|
||||
|
||||
Current.Logger.Debug<ServerMessengerBase>(() => $"Invoking refresher {refresher.GetType()} on local server for message type {messageType}");
|
||||
Current.Logger.Debug<ServerMessengerBase>("Invoking refresher {RefresherType} on local server for message type {MessageType}", refresher.GetType(), messageType);
|
||||
|
||||
var typedRefresher = refresher as ICacheRefresher<T>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user