mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Added Log4net configuration for recipes logging. Added logging to replace the removed reports logging.
This commit is contained in:
@@ -17,6 +17,12 @@
|
||||
</logger>
|
||||
-->
|
||||
|
||||
<logger name="Orchard.Recipes">
|
||||
<!-- Anything recipe-related goes into a dedicated file. -->
|
||||
<priority value="INFO" />
|
||||
<appender-ref ref="recipes-file" />
|
||||
</logger>
|
||||
|
||||
<logger name="Orchard">
|
||||
<!-- Messages coming from Orchard are sent to the attached debugger. -->
|
||||
<appender-ref ref="debugger"/>
|
||||
@@ -50,7 +56,6 @@
|
||||
</appender>
|
||||
|
||||
<appender name="debug-file" type="Orchard.Logging.OrchardFileAppender">
|
||||
<!-- Sends log messages to a file in App_Data. -->
|
||||
<file value="App_Data/Logs/orchard-debug" />
|
||||
<appendToFile value="true" />
|
||||
<!-- Immediate flush on error log, to avoid data loss with sudden termination. -->
|
||||
@@ -66,7 +71,6 @@
|
||||
</appender>
|
||||
|
||||
<appender name="error-file" type="Orchard.Logging.OrchardFileAppender">
|
||||
<!-- Sends ERROR and FATAL log messages to a file in App_Data. -->
|
||||
<file value="App_Data/Logs/orchard-error" />
|
||||
<appendToFile value="true" />
|
||||
<!-- Immediate flush on error log, to avoid data loss with sudden termination. -->
|
||||
@@ -85,4 +89,20 @@
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="recipes-file" type="Orchard.Logging.OrchardFileAppender">
|
||||
<!-- Sends ERROR and FATAL log messages to a file in App_Data. -->
|
||||
<file value="App_Data/Logs/orchard-recipes" />
|
||||
<appendToFile value="true" />
|
||||
<!-- Immediate flush on error log, to avoid data loss with sudden termination. -->
|
||||
<immediateFlush value="true" />
|
||||
<staticLogFileName value="false" />
|
||||
<rollingStyle value="Date" />
|
||||
<datepattern value="-yyyy.MM.dd'.log'" />
|
||||
<!-- Prevents Orchard.exe from displaying locking debug messages. -->
|
||||
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date [%thread] %logger - %P{Tenant} - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
</log4net>
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace Orchard.Modules.Controllers {
|
||||
}
|
||||
catch(Exception e) {
|
||||
Logger.Error(e, "Error while executing recipe {0} in {1}", moduleId, name);
|
||||
Services.Notifier.Error(T("Recipes contains {0} unsupported module installation steps.", recipe.Name));
|
||||
Services.Notifier.Error(T("Recipes {0} contains unsupported module installation steps.", recipe.Name));
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("The recipe {0} was executed successfully.", recipe.Name));
|
||||
@@ -229,8 +229,6 @@ namespace Orchard.Modules.Controllers {
|
||||
foreach (var feature in selectedFeaturesThatNeedUpdate) {
|
||||
var id = feature.Descriptor.Id;
|
||||
try {
|
||||
// TODO: LOGGING
|
||||
//_reportsCoordinator.Register("Data Migration", "Upgrade " + id, "Orchard installation");
|
||||
_dataMigrationManager.Update(id);
|
||||
Services.Notifier.Information(T("The feature {0} was updated successfully", id));
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ using Orchard.Environment.ShellBuilders;
|
||||
using Orchard.Environment.State;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Localization.Services;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Recipes.Models;
|
||||
using Orchard.Recipes.Services;
|
||||
using Orchard.Security;
|
||||
@@ -55,9 +56,11 @@ namespace Orchard.Setup.Services
|
||||
_extensionManager = extensionManager;
|
||||
_recipeHarvester = recipeHarvester;
|
||||
T = NullLocalizer.Instance;
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public ShellSettings Prime() {
|
||||
return _shellSettings;
|
||||
@@ -80,6 +83,8 @@ namespace Orchard.Setup.Services
|
||||
public string Setup(SetupContext context) {
|
||||
string executionId;
|
||||
|
||||
Logger.Information("Running setup for tenant '{0}'.", _shellSettings.Name);
|
||||
|
||||
// The vanilla Orchard distibution has the following features enabled.
|
||||
string[] hardcoded = {
|
||||
// Framework
|
||||
@@ -142,9 +147,6 @@ namespace Orchard.Setup.Services
|
||||
// Make a workaround to avoid the Transaction issue for PostgreSQL
|
||||
environment.Resolve<ITransactionManager>().RequireNew();
|
||||
|
||||
// TODO: LOGGING
|
||||
//reportsCoordinator.Register("Data Migration", "Setup", "Orchard installation");
|
||||
|
||||
schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
@@ -165,8 +167,6 @@ namespace Orchard.Setup.Services
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// in effect "pump messages" see PostMessage circa 1980
|
||||
while ( _processingEngine.AreTasksPending() )
|
||||
_processingEngine.ExecuteNextTask();
|
||||
|
||||
@@ -228,9 +228,9 @@ namespace Orchard.Themes.Controllers {
|
||||
return HttpNotFound();
|
||||
|
||||
try {
|
||||
// TODO: LOGGING
|
||||
_dataMigrationManager.Update(themeId);
|
||||
Services.Notifier.Information(T("The theme {0} was updated successfully", themeId));
|
||||
Services.Notifier.Information(T("The theme {0} was updated successfully.", themeId));
|
||||
Logger.Information("The theme {0} was updated successfully.", themeId);
|
||||
} catch (Exception exception) {
|
||||
Logger.Error(T("An error occured while updating the theme {0}: {1}", themeId, exception.Message).Text);
|
||||
Services.Notifier.Error(T("An error occured while updating the theme {0}: {1}", themeId, exception.Message));
|
||||
|
||||
@@ -13,6 +13,7 @@ using Orchard.Core.Title.Models;
|
||||
using Orchard.Data;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Security;
|
||||
using Orchard.UI.Admin;
|
||||
using Orchard.UI.Notify;
|
||||
@@ -38,9 +39,12 @@ namespace Upgrade.Controllers {
|
||||
_sessionFactoryHolder = sessionFactoryHolder;
|
||||
_shellSettings = shellSettings;
|
||||
_autorouteService = autorouteService;
|
||||
T = NullLocalizer.Instance;
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public ActionResult Index() {
|
||||
var viewModel = new MigrateViewModel { ContentTypes = new List<ContentTypeEntry>() };
|
||||
@@ -67,8 +71,8 @@ namespace Upgrade.Controllers {
|
||||
|
||||
if(TryUpdateModel(viewModel)) {
|
||||
|
||||
// TODO: LOGGING
|
||||
//_reportsCoordinator.Register("Migration", "Upgrade", "Migrating " + string.Join(" ,", viewModel.ContentTypes.Where(x => x.IsChecked).Select(x => x.ContentTypeName).ToArray()));
|
||||
var contentTypeNames = String.Join(" ,", viewModel.ContentTypes.Where(x => x.IsChecked).Select(x => x.ContentTypeName).ToArray());
|
||||
Logger.Information("Migrating content types: {0}", contentTypeNames);
|
||||
|
||||
var contentTypesToMigrate = viewModel.ContentTypes.Where(c => c.IsChecked).Select(c => c.ContentTypeName);
|
||||
|
||||
@@ -77,8 +81,7 @@ namespace Upgrade.Controllers {
|
||||
|
||||
foreach (var contentType in contentTypesToMigrate) {
|
||||
|
||||
// TODO: LOGGING
|
||||
//_reportsCoordinator.Information("Migration", "Adding parts to " + contentType);
|
||||
Logger.Information("Adding parts to content type '{0}'.", contentType);
|
||||
|
||||
// migrating parts
|
||||
_contentDefinitionManager.AlterTypeDefinition(contentType,
|
||||
@@ -131,8 +134,7 @@ namespace Upgrade.Controllers {
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
// TODO: LOGGING
|
||||
//_reportsCoordinator.Error("Migration", "Migrating content item " + autoroutePart.ContentItem.Id + " failed with: " + e.Message);
|
||||
Logger.Error("Migration of content item '{0}' failed: {1}", autoroutePart.ContentItem.Id, e.Message);
|
||||
errors = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,16 +329,13 @@ namespace Orchard.Data.Migration.Interpreters {
|
||||
|
||||
try {
|
||||
foreach (var sqlStatement in _sqlStatements) {
|
||||
Logger.Debug(sqlStatement);
|
||||
Logger.Debug("Executing SQL query: {0}", sqlStatement);
|
||||
|
||||
using (var command = session.Connection.CreateCommand()) {
|
||||
command.CommandText = sqlStatement;
|
||||
session.Transaction.Enlist(command);
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
// TODO: LOGGING
|
||||
//_reportsCoordinator.Information("Data Migration", String.Format("Executing SQL Query: {0}", sqlStatement));
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
||||
Reference in New Issue
Block a user