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:
@@ -1,88 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<log4net>
|
||||
|
||||
<!-- If you are looking here and want more output, first thing to do is change root/priority/@value to "INFO" or "ALL". -->
|
||||
<!-- If you are looking here and want more output, first thing to do is change root/priority/@value to "INFO" or "ALL". -->
|
||||
|
||||
<root>
|
||||
<!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF. -->
|
||||
<priority value="WARN" />
|
||||
<appender-ref ref="error-file" />
|
||||
<appender-ref ref="debug-file" />
|
||||
</root>
|
||||
<root>
|
||||
<!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF. -->
|
||||
<priority value="WARN" />
|
||||
<appender-ref ref="error-file" />
|
||||
<appender-ref ref="debug-file" />
|
||||
</root>
|
||||
|
||||
<!-- Example of turning on the output from a component or namespace. -->
|
||||
<!--
|
||||
<logger name="Orchard.Data.SessionLocator">
|
||||
<priority value="INFO" />
|
||||
</logger>
|
||||
-->
|
||||
<!-- Example of turning on the output from a component or namespace. -->
|
||||
<!--
|
||||
<logger name="Orchard.Data.SessionLocator">
|
||||
<priority value="INFO" />
|
||||
</logger>
|
||||
-->
|
||||
|
||||
<logger name="Orchard">
|
||||
<!-- Messages coming from Orchard are sent to the attached debugger. -->
|
||||
<appender-ref ref="debugger"/>
|
||||
<!-- Note: if you put a ref=debugger into <root> element above and widen the priority to ALL or DEBUG, then you will see nhibernate trace in the attached debugger as well. -->
|
||||
</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.Localization">
|
||||
<!-- This source is very verbose - setting priority here to avoid flooding trace if root priority is lowered. -->
|
||||
<priority value="WARN" />
|
||||
</logger>
|
||||
<logger name="Orchard">
|
||||
<!-- Messages coming from Orchard are sent to the attached debugger. -->
|
||||
<appender-ref ref="debugger"/>
|
||||
<!-- Note: if you put a ref=debugger into <root> element above and widen the priority to ALL or DEBUG, then you will see nhibernate trace in the attached debugger as well. -->
|
||||
</logger>
|
||||
|
||||
<logger name="NHibernate.Cache">
|
||||
<!-- This source is very verbose - setting priority here to avoid flooding trace if root priority is lowered. -->
|
||||
<priority value="ERROR" />
|
||||
</logger>
|
||||
<logger name="Orchard.Localization">
|
||||
<!-- This source is very verbose - setting priority here to avoid flooding trace if root priority is lowered. -->
|
||||
<priority value="WARN" />
|
||||
</logger>
|
||||
|
||||
<logger name="NHibernate.AdoNet.AbstractBatcher">
|
||||
<!-- Displays failed table statements that are otherwise intercepted and rendered when unexpected. -->
|
||||
<priority value="OFF" />
|
||||
</logger>
|
||||
<logger name="NHibernate.Cache">
|
||||
<!-- This source is very verbose - setting priority here to avoid flooding trace if root priority is lowered. -->
|
||||
<priority value="ERROR" />
|
||||
</logger>
|
||||
|
||||
<logger name="NHibernate.Util.ADOExceptionReporter">
|
||||
<!-- Displays failed table statements that are otherwise intercepted and rendered when unexpected. -->
|
||||
<priority value="OFF" />
|
||||
</logger>
|
||||
<logger name="NHibernate.AdoNet.AbstractBatcher">
|
||||
<!-- Displays failed table statements that are otherwise intercepted and rendered when unexpected. -->
|
||||
<priority value="OFF" />
|
||||
</logger>
|
||||
|
||||
<appender name="debugger" type="log4net.Appender.DebugAppender">
|
||||
<!-- Sends log messages to Visual Studio if attached. -->
|
||||
<immediateFlush value="true" />
|
||||
<layout type="log4net.Layout.SimpleLayout" />
|
||||
</appender>
|
||||
<logger name="NHibernate.Util.ADOExceptionReporter">
|
||||
<!-- Displays failed table statements that are otherwise intercepted and rendered when unexpected. -->
|
||||
<priority value="OFF" />
|
||||
</logger>
|
||||
|
||||
<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. -->
|
||||
<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>
|
||||
<appender name="debugger" type="log4net.Appender.DebugAppender">
|
||||
<!-- Sends log messages to Visual Studio if attached. -->
|
||||
<immediateFlush value="true" />
|
||||
<layout type="log4net.Layout.SimpleLayout" />
|
||||
</appender>
|
||||
|
||||
<appender name="debug-file" type="Orchard.Logging.OrchardFileAppender">
|
||||
<file value="App_Data/Logs/orchard-debug" />
|
||||
<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>
|
||||
|
||||
<appender name="error-file" type="Orchard.Logging.OrchardFileAppender">
|
||||
<file value="App_Data/Logs/orchard-error" />
|
||||
<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" />
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<!-- Only ERROR and FATAL log messages end up in this target, even if child loggers accept lower priority. -->
|
||||
<levelMin value="ERROR" />
|
||||
</filter>
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date [%thread] %logger - %P{Tenant} - %message%newline %P{Url}%newline" />
|
||||
</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>
|
||||
|
||||
<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. -->
|
||||
<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" />
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<!-- Only ERROR and FATAL log messages end up in this target, even if child loggers accept lower priority. -->
|
||||
<levelMin value="ERROR" />
|
||||
</filter>
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<conversionPattern value="%date [%thread] %logger - %P{Tenant} - %message%newline %P{Url}%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,9 +71,9 @@ 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);
|
||||
|
||||
var sessionFactory = _sessionFactoryHolder.GetSessionFactory();
|
||||
@@ -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