diff --git a/src/Umbraco.Core/Services/ContentTypeService.cs b/src/Umbraco.Core/Services/ContentTypeService.cs index b62875fc6b..5ecf8b05f8 100644 --- a/src/Umbraco.Core/Services/ContentTypeService.cs +++ b/src/Umbraco.Core/Services/ContentTypeService.cs @@ -7,6 +7,7 @@ using System.Web; using Umbraco.Core.Auditing; using Umbraco.Core.Configuration; using Umbraco.Core.Events; +using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.Querying; @@ -435,8 +436,7 @@ namespace Umbraco.Core.Services } catch (Exception exception) { - // Note, Log.Add quietly swallows the exception if it can't write to the database - //Log.Add(LogTypes.System, -1, string.Format("{0} while trying to build DTD for Xml schema; is Umbraco installed correctly and the connection string configured?", exception.Message)); + LogHelper.Error("Error while trying to build DTD for Xml schema; is Umbraco installed correctly and the connection string configured?", exception); } } diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs index d621443808..70d1a2d3e6 100644 --- a/src/Umbraco.Web/umbraco.presentation/content.cs +++ b/src/Umbraco.Web/umbraco.presentation/content.cs @@ -379,12 +379,12 @@ namespace umbraco prov.UpdateNode(n); else { - Log.Add(LogTypes.Error, d.Id, "Can't update Sitemap Provider due to empty Url in node"); + LogHelper.Debug(string.Format("Can't update Sitemap Provider due to empty Url in node id: {0}", d.Id)); } } catch (Exception ee) { - Log.Add(LogTypes.Error, d.Id, string.Format("Error adding node to Sitemap Provider in PublishNodeDo(): {0}", ee)); + LogHelper.Error(string.Format("Error adding node to Sitemap Provider in PublishNodeDo(): {0}", d.Id), ee); } } } @@ -1041,7 +1041,7 @@ namespace umbraco lock (_readerWriterSyncLock) { var xmlDoc = new XmlDocument(); - Log.Add(LogTypes.System, User.GetUser(0), -1, "Loading content from disk cache..."); + LogHelper.Info("Loading content from disk cache..."); xmlDoc.Load(UmbracoXmlDiskCacheFileName); _lastDiskCacheReadTime = DateTime.UtcNow; return xmlDoc; @@ -1078,7 +1078,7 @@ namespace umbraco } // Try to log to the DB - Log.Add(LogTypes.System, staticUser, -1, "Loading content from database..."); + LogHelper.Info("Loading content from database..."); var hierarchy = new Dictionary>(); var nodeIndex = new Dictionary(); @@ -1176,24 +1176,21 @@ order by umbracoNode.level, umbracoNode.sortOrder"; } catch (Exception ee) { - Log.Add(LogTypes.Error, staticUser, -1, - string.Format("Error while generating XmlDocument from database: {0}", ee)); + LogHelper.Error("Error while generating XmlDocument from database", ee); } } - catch (OutOfMemoryException) + catch (OutOfMemoryException ee) { - Log.Add(LogTypes.Error, staticUser, -1, - string.Format("Error Republishing: Out Of Memory. Parents: {0}, Nodes: {1}", - hierarchy.Count, nodeIndex.Count)); + LogHelper.Error(string.Format("Error Republishing: Out Of Memory. Parents: {0}, Nodes: {1}", hierarchy.Count, nodeIndex.Count), ee); } catch (Exception ee) { - Log.Add(LogTypes.Error, staticUser, -1, string.Format("Error Republishing: {0}", ee)); + LogHelper.Error("Error Republishing", ee); } } catch (Exception ee) { - Log.Add(LogTypes.Error, -1, string.Format("Error Republishing: {0}", ee)); + LogHelper.Error("Error Republishing", ee); } // An error of some sort must have stopped us from successfully generating @@ -1304,7 +1301,8 @@ order by umbracoNode.level, umbracoNode.sortOrder"; Trace.Write(string.Format( "Error saving content on thread '{0}' due to '{1}' (Threadpool? {2})", Thread.CurrentThread.Name, ee.Message, Thread.CurrentThread.IsThreadPoolThread)); - Log.Add(LogTypes.Error, staticUser, -1, string.Format("Xml wasn't saved: {0}", ee)); + + LogHelper.Error("Xml wasn't saved", ee); } } } diff --git a/src/Umbraco.Web/umbraco.presentation/library.cs b/src/Umbraco.Web/umbraco.presentation/library.cs index 8a78f77168..1c64fbc96a 100644 --- a/src/Umbraco.Web/umbraco.presentation/library.cs +++ b/src/Umbraco.Web/umbraco.presentation/library.cs @@ -10,6 +10,7 @@ using System.Web.UI; using System.Xml; using System.Xml.XPath; using Umbraco.Core; +using Umbraco.Core.Logging; using Umbraco.Web; using Umbraco.Web.Routing; using Umbraco.Web.Templates; @@ -286,55 +287,6 @@ namespace umbraco content.Instance.RefreshContentFromDatabaseAsync(); } - //private static Hashtable parents = new Hashtable(); - //private static Hashtable nodes = new Hashtable(); - //private static int nodeRepublishCounter = 0; - //public static void RePublishNodesDotNet(int nodeID) - //{ - // RePublishNodesDotNet(nodeID, true); - //} - // Esben Carlsen: Commented out, is not referenced anywhere - //public static void _RePublishNodesDotNet(int nodeID, bool SaveToDisk) - //{ - // content.isInitializing = true; - // content.Instance.XmlContent = null; - // BusinessLogic.Log.Add(BusinessLogic.LogTypes.Debug, BusinessLogic.User.GetUser(0), -1, "Republishing starting"); - // cms.businesslogic.cache.Cache.ClearAllCache(); - // XmlDocument xmlDoc = new XmlDocument(); - // // Create id -1 attribute - // xmlDoc.LoadXml(""); - // XmlNode n = xmlDoc.DocumentElement; - // buildNodes(ref xmlDoc, ref n, -1); - // content.Instance.XmlContent.Load(n.OuterXml); - // // reload xml - // n = null; - // xmlDoc = null; - // if (SaveToDisk) - // content.SaveCacheToDisk(false); - // // Reload content - // requestHandler.ClearProcessedRequests(); - // content.clearContentCache(); - // BusinessLogic.Log.Add(BusinessLogic.LogTypes.Debug, BusinessLogic.User.GetUser(0), -1, "Republishing done"); - // content.isInitializing = false; - //} - // private static void buildNodes(ref XmlDocument Xd, ref XmlNode CurrentElement, int ParentId) - // { - // string sql = - // @"select umbracoNode.id, umbracoNode.sortOrder, cmsContentXml.xml from umbracoNode - // inner join cmsContentXml on cmsContentXml.nodeId = umbracoNode.id and umbracoNode.nodeObjectType = 'C66BA18E-EAF3-4CFF-8A22-41B16D66A972' - // and umbracoNode.parentId = @parentId - // order by umbracoNode.sortOrder"; - // IRecordsReader dr = - // SqlHelper.ExecuteReader(sql, SqlHelper.CreateParameter("@parentId", ParentId)); - // while(dr.Read()) - // { - // int currentId = int.Parse(dr["id"].ToString()); - // XmlNode n = xmlHelper.ImportXmlNodeFromText(dr["xml"].ToString(), ref Xd); - // CurrentElement.AppendChild(n); - // buildNodes(ref Xd, ref n, currentId); - // } - // dr.Close(); - // } /// /// Refreshes the runtime xml index. /// Note: This *doesn't* mark any non-published document objects as published @@ -1698,7 +1650,7 @@ namespace umbraco } catch (Exception ee) { - Log.Add(LogTypes.Error, -1, string.Format("umbraco.library.SendMail: Error sending mail. Exception: {0}", ee)); + LogHelper.Error("umbraco.library.SendMail: Error sending mail.", ee); } } diff --git a/src/Umbraco.Web/umbraco.presentation/publishingService.cs b/src/Umbraco.Web/umbraco.presentation/publishingService.cs index f45c6d5916..1f7c6c7c2c 100644 --- a/src/Umbraco.Web/umbraco.presentation/publishingService.cs +++ b/src/Umbraco.Web/umbraco.presentation/publishingService.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Net; using System.Web; using System.Xml; - +using Umbraco.Core.Logging; using umbraco.BusinessLogic; using umbraco.cms.businesslogic.web; @@ -43,11 +43,7 @@ namespace umbraco.presentation } catch(Exception ee) { - Log.Add( - LogTypes.Error, - BusinessLogic.User.GetUser(0), - d.Id, - string.Format("Error publishing node: {0}", ee)); + LogHelper.Error(string.Format("Error publishing node {0}", d.Id), ee); } } foreach(Document d in Document.GetDocumentsForExpiration()) @@ -64,11 +60,7 @@ namespace umbraco.presentation } catch (Exception ee) { - Log.Add( - LogTypes.Error, - BusinessLogic.User.GetUser(0), - d.Id, - string.Format("Error unpublishing node: {0}", ee)); + LogHelper.Error(string.Format("Error unpublishing node {0}", d.Id), ee); } } @@ -106,9 +98,7 @@ namespace umbraco.presentation { bool taskResult = getTaskByHttp(task.Attributes.GetNamedItem("url").Value); if (bool.Parse(task.Attributes.GetNamedItem("log").Value)) - Log.Add(LogTypes.ScheduledTask, User.GetUser(0), -1, - string.Format("{0} has been called with response: {1}", - task.Attributes.GetNamedItem("alias").Value, taskResult)); + LogHelper.Info(string.Format("{0} has been called with response: {1}", task.Attributes.GetNamedItem("alias").Value, taskResult)); } } } @@ -116,8 +106,7 @@ namespace umbraco.presentation } catch(Exception ee) { - Log.Add(LogTypes.Error, User.GetUser(0), -1, - string.Format("Error executing scheduled task: {0}", ee)); + LogHelper.Error("Error executing scheduled task", ee); } } catch(Exception x) diff --git a/src/Umbraco.Web/umbraco.presentation/requestHandler.cs b/src/Umbraco.Web/umbraco.presentation/requestHandler.cs index cd7f498e0c..8b5bb2e980 100644 --- a/src/Umbraco.Web/umbraco.presentation/requestHandler.cs +++ b/src/Umbraco.Web/umbraco.presentation/requestHandler.cs @@ -588,8 +588,7 @@ namespace umbraco { public bool Execute(string url) { try { - Log.Add(LogTypes.NotFound, User.GetUser(0), -1, - url + " (from '" + HttpContext.Current.Request.UrlReferrer + "')"); + LogHelper.Info(string.Format("NotFound url {0} (from '{1}')", url, HttpContext.Current.Request.UrlReferrer)); // Test if the error404 not child elements string error404 = umbraco.library.GetCurrentNotFoundPageId(); diff --git a/src/Umbraco.Web/umbraco.presentation/requestModule.cs b/src/Umbraco.Web/umbraco.presentation/requestModule.cs index c22eb7b6fe..f827757198 100644 --- a/src/Umbraco.Web/umbraco.presentation/requestModule.cs +++ b/src/Umbraco.Web/umbraco.presentation/requestModule.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Threading; using System.Web; using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; using umbraco.BusinessLogic; using System.Collections.Generic; using umbraco.BusinessLogic.Utils; @@ -260,7 +261,8 @@ namespace umbraco.presentation { } - Log.Add(LogTypes.Error, staticUser, -1, error); + LogHelper.Debug(error); + Trace.TraceError(error); lock (unhandledErrors) { @@ -356,7 +358,8 @@ namespace umbraco.presentation try { - Log.Add(LogTypes.System, -1, "Application started at " + DateTime.Now); + LogHelper.Info(string.Format("Application started at {0}", DateTime.Now)); + if (UmbracoSettings.AutoCleanLogs) { AddTask(LOG_SCRUBBER_TASK_NAME, GetLogScrubbingInterval()); @@ -422,7 +425,7 @@ namespace umbraco.presentation } catch (Exception) { - Log.Add(LogTypes.System, -1, "Unable to locate a log scrubbing interval. Defaulting to 24 horus"); + LogHelper.Info("Unable to locate a log scrubbing interval. Defaulting to 24 hours"); } return interval; } @@ -437,7 +440,7 @@ namespace umbraco.presentation } catch (Exception) { - Log.Add(LogTypes.System, -1, "Unable to locate a log scrubbing maximum age. Defaulting to 24 horus"); + LogHelper.Info("Unable to locate a log scrubbing maximum age. Defaulting to 24 hours"); } return maximumAge; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/cache/dispatcher.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/cache/dispatcher.cs index f45de0ca7d..0f95aace02 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/cache/dispatcher.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/cache/dispatcher.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Net; using System.Threading; using System.Xml; @@ -185,12 +186,7 @@ namespace umbraco.presentation.cache private static void LogDispatchBatchResult(int errorCount) { - Log.Add( - LogTypes.System, - User.GetUser(0), - -1, - string.Format("Distributed server push completed with {0} nodes reporting an error", - errorCount == 0 ? "no" : errorCount.ToString())); + LogHelper.Debug(string.Format("Distributed server push completed with {0} nodes reporting an error", errorCount == 0 ? "no" : errorCount.ToString(CultureInfo.InvariantCulture))); } private static void LogDispatchNodeError(Exception ex) @@ -230,11 +226,7 @@ namespace umbraco.presentation.cache private static void LogStartDispatch() { - Log.Add( - LogTypes.System, - User.GetUser(0), - -1, - "Submitting calls to distributed servers"); + LogHelper.Info("Submitting calls to distributed servers"); } /// diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/CreatedPackageTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/CreatedPackageTasks.cs index c2e53fe9a1..3474022c8d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/CreatedPackageTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/CreatedPackageTasks.cs @@ -1,6 +1,7 @@ using System; using System.Data; using System.Web.Security; +using Umbraco.Core.Logging; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; @@ -41,9 +42,7 @@ namespace umbraco public bool Save() { - - umbraco.BusinessLogic.User myUser = new umbraco.BusinessLogic.User(0); - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Delete, myUser, 0, "Xml save started"); + LogHelper.Info("Xml save started"); int id = cms.businesslogic.packager.CreatedPackage.MakeNew(Alias).Data.Id; m_returnUrl = string.Format("developer/packages/editPackage.aspx?id={0}", id); return true; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/DLRScriptingTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/DLRScriptingTasks.cs index aba25ebdef..c1807623b1 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/DLRScriptingTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/DLRScriptingTasks.cs @@ -1,6 +1,7 @@ using System; using System.Data; using System.Web.Security; +using Umbraco.Core.Logging; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; @@ -122,7 +123,7 @@ namespace umbraco } catch (Exception ex) { - Log.Add(LogTypes.Error, UmbracoEnsuredPage.CurrentUser, -1, "Could not remove XSLT file " + Alias + ". ERROR: " + ex.Message); + LogHelper.Error(string.Format("Could not remove DLR file {0} - User {1}", Alias, UmbracoEnsuredPage.CurrentUser.Id), ex); } return true; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs index 1d8d874332..2260ea4ea9 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs @@ -60,18 +60,6 @@ namespace umbraco { return false; } - //try - //{ - - // MembershipUser u = Membership.GetUser(_parentID); - // Membership.DeleteUser(u.UserName); - // return true; - - //}catch - //{ - // Log.Add(LogTypes.Error, _parentID, "Member cannot be deleted."); - // return false; - //} } public MemberGroupTasks() diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/ScriptTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/ScriptTasks.cs index db562364cc..4a46a80c87 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/ScriptTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/ScriptTasks.cs @@ -1,6 +1,7 @@ using System; using System.Data; using System.Web.Security; +using Umbraco.Core.Logging; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; @@ -82,7 +83,8 @@ namespace umbraco else if (System.IO.Directory.Exists(path)) System.IO.Directory.Delete(path, true); - BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Delete, umbraco.BasePages.UmbracoEnsuredPage.CurrentUser, -1, _alias + " Deleted"); + LogHelper.Info(string.Format("{0} Deleted by user {1}", _alias, UmbracoEnsuredPage.CurrentUser.Id)); + return true; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/XsltTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/XsltTasks.cs index 57046ef64b..48c7d551e6 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/XsltTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/XsltTasks.cs @@ -1,6 +1,7 @@ using System; using System.Data; using System.Web.Security; +using Umbraco.Core.Logging; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; @@ -113,7 +114,7 @@ namespace umbraco } catch (Exception ex) { - Log.Add(LogTypes.Error, UmbracoEnsuredPage.CurrentUser, -1, "Could not remove XSLT file " + Alias + ". ERROR: " + ex.Message); + LogHelper.Error(string.Format("Could not remove XSLT file {0} - User {1}", Alias, UmbracoEnsuredPage.CurrentUser.Id), ex); } return true; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/dialogHandler_temp.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/dialogHandler_temp.cs index 4a5900d1cf..fa40353c33 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/dialogHandler_temp.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/dialogHandler_temp.cs @@ -81,17 +81,6 @@ namespace umbraco.presentation.create } } - - //try - //{ - - //} - //catch (Exception ex) - //{ - // Log.Add(LogTypes.Error, UmbracoEnsuredPage.CurrentUser, -1, string.Format("Could not create node ({0},{1},{2},{3} ERROR: {4}", NodeType, TypeId, NodeId, Text, ex.Message)); - // return ""; - //} - return ""; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/mediaTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/mediaTasks.cs index afee28e600..200657ab94 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/mediaTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/mediaTasks.cs @@ -1,6 +1,7 @@ using System; using System.Data; using System.Web.Security; +using Umbraco.Core.Logging; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; @@ -66,7 +67,7 @@ namespace umbraco cms.businesslogic.media.Media d = new cms.businesslogic.media.Media(ParentID); // Log - BusinessLogic.Log.Add(BusinessLogic.LogTypes.Delete, User.GetCurrent(), d.Id, ""); + LogHelper.Debug(string.Format("Delete media item {0} by user {1}", d.Id, User.GetCurrent().Id)); d.delete(); return true; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs index 83aae970d0..b62b6d0bc3 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs @@ -1,4 +1,6 @@ -namespace dashboardUtilities +using Umbraco.Core.Logging; + +namespace dashboardUtilities { using System; using System.Linq; @@ -40,7 +42,7 @@ } else { - Log.Add(LogTypes.Error, -1, string.Format("Access to unallowed feedproxy attempted: {0}", requestUri)); + LogHelper.Debug(string.Format("Access to unallowed feedproxy attempted: {0}", requestUri)); } } } @@ -48,7 +50,7 @@ } catch (Exception ex) { - Log.Add(LogTypes.Error, -1, ex.ToString()); + LogHelper.Error("Exception occurred", ex); } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/publish.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/publish.aspx.cs index 9feee1ecd9..51b943c413 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/publish.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/publish.aspx.cs @@ -10,6 +10,7 @@ using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Threading; +using Umbraco.Core.Logging; using umbraco.cms.helpers; using umbraco.BasePages; @@ -155,7 +156,7 @@ namespace umbraco.dialogs } } else { - BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Error, d.Id, "Publishing failed due to event cancelling the publishing"); + LogHelper.Debug(string.Format("Publishing node {0} failed due to event cancelling the publishing", d.Id)); } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs index e07d7ff2f9..e1b71bab1b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs @@ -9,6 +9,7 @@ using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; +using Umbraco.Core.Logging; using umbraco.BusinessLogic; using System.Web.Security; using umbraco.businesslogic.Exceptions; @@ -141,7 +142,8 @@ namespace umbraco.cms.presentation { if (!isUrlLocalToHost(url)) { - Log.Add(LogTypes.Error, -1, String.Format("Security warning: Login redirect was attempted to a site at another domain: '{0}'", url)); + LogHelper.Info(String.Format("Security warning: Login redirect was attempted to a site at another domain: '{0}'", url)); + throw new UserAuthorizationException( String.Format(@"There was attempt to redirect to '{0}' which is another domain than where you've logged in. If you clicked a link to reach this login screen, please double check that the link came from someone you trust. You *might* have been exposed to an *attempt* to breach the security of your website. Nothing diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/UmbracoSiteMapProvider.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/UmbracoSiteMapProvider.cs index 221ee75c27..f3f082e9e8 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/UmbracoSiteMapProvider.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/UmbracoSiteMapProvider.cs @@ -5,6 +5,7 @@ using System.Text; using System.Web; using System.Web.Security; using System.Configuration; +using Umbraco.Core.Logging; using umbraco.BusinessLogic; using System.Security.Cryptography; using System.Web.Util; @@ -60,10 +61,7 @@ namespace umbraco.presentation.nodeFactory { try { AddNode(m_root, null); } catch (Exception ex) { - BusinessLogic.Log.Add( - LogTypes.Error, - -1, - String.Format("Error adding to SiteMapProvider: {0}", ex)); + LogHelper.Error("Error adding to SiteMapProvider", ex); } loadNodes(m_root.Key, m_root); @@ -89,10 +87,7 @@ namespace umbraco.presentation.nodeFactory { try { AddNode(n, m_nodes[parentNode]); } catch (Exception ex) { - BusinessLogic.Log.Add( - LogTypes.Error, - -1, - String.Format("Error adding node with url '{0}' to SiteMapProvider: {1}", node.Name, ex)); + LogHelper.Error(String.Format("Error adding node with url '{0}' and Id {1} to SiteMapProvider", node.Name, node.Id), ex); } } else { n = m_nodes[node.Id.ToString()]; @@ -127,10 +122,7 @@ namespace umbraco.presentation.nodeFactory { try { AddNode(childNode, parentNode); } catch (Exception ex) { - BusinessLogic.Log.Add( - LogTypes.Error, - child.Id, - String.Format("Error adding to SiteMapProvider in loadNodes(): {0}", ex)); + LogHelper.Error(string.Format("Error adding node {0} to SiteMapProvider in loadNodes()", child.Id), ex); } loadNodes(child.Id.ToString(), childNode); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/ping.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/ping.aspx.cs index 21aa5229b5..63059d804c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/ping.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/ping.aspx.cs @@ -18,14 +18,6 @@ namespace umbraco.presentation { protected void Page_Load(object sender, System.EventArgs e) { - /* - if (GlobalSettings.DebugMode) - BusinessLogic.Log.Add( - BusinessLogic.LogTypes.Ping, - BusinessLogic.User.GetUser(0), - -1, - ""); - */ } #region Web Form Designer generated code diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/plugins/tinymce3/GzipModule.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/plugins/tinymce3/GzipModule.cs index 9c5b6239ab..390de21e89 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/plugins/tinymce3/GzipModule.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/plugins/tinymce3/GzipModule.cs @@ -9,6 +9,7 @@ using System; using System.Web; using System.Text.RegularExpressions; using System.IO; +using Umbraco.Core.Logging; using umbraco.IO; namespace umbraco.presentation.plugins.tinymce3 @@ -65,8 +66,7 @@ namespace umbraco.presentation.plugins.tinymce3 } else { - BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Error, -1, - String.Format("TinyMCE: Error loading language '{0}'. Please download language pack from tinymce.moxiecode.com", lang)); + LogHelper.Info(string.Format("TinyMCE: Error loading language '{0}'. Please download language pack from tinymce.moxiecode.com", lang)); } } // Add themes diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/preview/PreviewContent.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/preview/PreviewContent.cs index 92f6203beb..7deebd1613 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/preview/PreviewContent.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/preview/PreviewContent.cs @@ -11,6 +11,7 @@ using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Xml; using System.IO; +using Umbraco.Core.Logging; using umbraco.cms.businesslogic.web; using umbraco.BusinessLogic; using umbraco.cms.businesslogic; @@ -79,7 +80,8 @@ namespace umbraco.presentation.preview if (validate && !ValidatePreviewPath()) { // preview cookie failed so we'll log the error and clear the cookie - Log.Add(LogTypes.Error, User.GetUser(_userId), -1, string.Format("Preview failed for preview set {0}", previewSet)); + LogHelper.Debug(string.Format("Preview failed for preview set {0} for user {1}", previewSet, _userId)); + PreviewSet = Guid.Empty; PreviewsetPath = String.Empty; @@ -152,9 +154,9 @@ namespace umbraco.presentation.preview { file.Delete(); } - catch + catch (Exception ex) { - Log.Add(LogTypes.Error, User.GetUser(userId), -1, String.Format("Couldn't delete preview set: {0}", file.Name)); + LogHelper.Error(string.Format("Couldn't delete preview set: {0} - User {1}", file.Name, userId), ex); } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/timerModule.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/timerModule.cs index 7dcee084d8..2f747cf79d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/timerModule.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/timerModule.cs @@ -1,8 +1,7 @@ using System.Data; using System.Threading; using System.Web; - - +using Umbraco.Core.Logging; using umbraco.BusinessLogic; namespace umbraco @@ -18,14 +17,14 @@ namespace umbraco public void Init(HttpApplication context) { - Log.Add((LogTypes)(-1), -1, "timer init"); + LogHelper.Debug("timer init"); t = new Timer(new TimerCallback(this.doStuff), context.Context, 1000, 1000); } private void doStuff(object sender) { - Log.Add((LogTypes)(-1), -1, "timer ping"); + LogHelper.Debug("timer ping"); } public void Dispose() diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-DataTypes.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-DataTypes.cs index 5467a13f46..3aca4adda3 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-DataTypes.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-DataTypes.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; +using Umbraco.Core.Logging; +using Umbraco.Web; using umbraco.BusinessLogic; using umbraco.cms.businesslogic.datatype; @@ -74,7 +76,7 @@ namespace umbraco } catch (Exception ex) { - Log.Add(LogTypes.Error, dataTypeDefinition.Id, ex.Message); + LogHelper.Error(string.Format("uQuery error in datatype definition {0}", dataTypeDefinition.Id), ex); } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery.cs index 5112937d24..0b46a6582f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery.cs @@ -4,6 +4,8 @@ using System.IO; using System.Linq; using System.Web; using System.Xml; +using Umbraco.Core.Logging; +using Umbraco.Web; using umbraco; using umbraco.BusinessLogic; using umbraco.DataLayer; @@ -88,7 +90,7 @@ namespace umbraco } catch (Exception ex) { - Log.Add(LogTypes.Error, -1, ex.Message); + LogHelper.Error("uQuery error", ex); } return null; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs index 0ef2ec1d94..c229c47c36 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Xml; - +using Umbraco.Core.Logging; using umbraco.BasePages; using umbraco.BusinessLogic; using umbraco.cms.businesslogic.media; @@ -506,7 +506,7 @@ namespace umbraco.cms.presentation.user catch (Exception ex) { ClientTools.ShowSpeechBubble(speechBubbleIcon.error, ui.Text("speechBubbles", "editUserError", base.getUser()), ""); - Log.Add(LogTypes.Error, 0, ex.Message); + LogHelper.Error("Exception", ex); } } else diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MediaUploader.ashx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MediaUploader.ashx.cs index 51ac1743b2..65180e4286 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MediaUploader.ashx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MediaUploader.ashx.cs @@ -11,6 +11,7 @@ using System.Web.Security; using System.Web.UI; using System.Xml; using System.Xml.Serialization; +using Umbraco.Core.Logging; using umbraco.BasePages; using umbraco.BusinessLogic; using umbraco.businesslogic.Exceptions; @@ -190,18 +191,18 @@ namespace umbraco.presentation.umbraco.webservices scripts.SyncTree(parentNode.Path, true); // log succes - Log.Add(LogTypes.New, parentNodeId, "Succes"); + LogHelper.Info(string.Format("Success uploading to parent {0}", parentNodeId)); } catch (Exception e) { // log error - Log.Add(LogTypes.Error, parentNodeId, e.ToString()); + LogHelper.Error(string.Format("Error uploading to parent {0}", parentNodeId), e); } } else { // log error - Log.Add(LogTypes.Error, -1, "Parent node id is in incorrect format"); + LogHelper.Debug(string.Format("Parent node id is in incorrect format: {0}", parentNodeId)); } diff --git a/src/umbraco.businesslogic/Log.cs b/src/umbraco.businesslogic/Log.cs index 89ccc31587..63d9268fee 100644 --- a/src/umbraco.businesslogic/Log.cs +++ b/src/umbraco.businesslogic/Log.cs @@ -247,7 +247,8 @@ namespace umbraco.BusinessLogic SqlHelper.ExecuteNonQuery("delete from umbracoLog where datestamp < @oldestPermittedLogEntry and logHeader in ('open','system')", SqlHelper.CreateParameter("@oldestPermittedLogEntry", formattedDate)); - Add(LogTypes.System, -1, "Log scrubbed. Removed all items older than " + formattedDate); + + LogHelper.Info(string.Format("Log scrubbed. Removed all items older than {0}", formattedDate)); } catch (Exception e) { diff --git a/src/umbraco.businesslogic/Utils/TypeResolver.cs b/src/umbraco.businesslogic/Utils/TypeResolver.cs index 8dfca2426a..1d13c1c765 100644 --- a/src/umbraco.businesslogic/Utils/TypeResolver.cs +++ b/src/umbraco.businesslogic/Utils/TypeResolver.cs @@ -120,30 +120,6 @@ namespace umbraco.BusinessLogic.Utils } } - /* - try{ - System.Collections.IList list = System.Web.Compilation.BuildManager.CodeAssemblies; - if (list != null && list.Count > 0) { - Assembly asm; - foreach (object o in list) { - asm = o as Assembly; - - Log.Add(LogTypes.Debug, -1, "assembly " + asm.ToString() ); - if (asm != null) { - foreach (Type t in asm.GetExportedTypes()) { - if (!t.IsInterface && assignTypeFrom.IsAssignableFrom(t)) - result.Add(t.AssemblyQualifiedName); - } - } - } - } else { - Log.Add(LogTypes.Debug, -1, "No assemblies"); - } - } catch(Exception ee) { - Log.Add(LogTypes.Debug, -1, ee.ToString()); - } - */ - return result.ToArray(); } diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs index 636b1900e6..cdbb5c5c82 100644 --- a/src/umbraco.cms/businesslogic/web/Document.cs +++ b/src/umbraco.cms/businesslogic/web/Document.cs @@ -1597,7 +1597,7 @@ and node.nodeObjectType='C66BA18E-EAF3-4CFF-8A22-41B16D66A972'"); } else { - Log.Add(LogTypes.System, d.Id, "Document not published so XML cannot be generated"); + LogHelper.Debug(string.Format("Document {0} not published so XML cannot be generated", d.Id)); } } diff --git a/src/umbraco.cms/businesslogic/web/DocumentType.cs b/src/umbraco.cms/businesslogic/web/DocumentType.cs index 5a419373be..6c7ab170ec 100644 --- a/src/umbraco.cms/businesslogic/web/DocumentType.cs +++ b/src/umbraco.cms/businesslogic/web/DocumentType.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Text; using System.Xml; using System.Linq; +using Umbraco.Core.Logging; using umbraco.BusinessLogic; using umbraco.cms.businesslogic.propertytype; using umbraco.DataLayer; @@ -102,8 +103,7 @@ namespace umbraco.cms.businesslogic.web } catch (Exception exception) { - // Note, Log.Add quietly swallows the exception if it can't write to the database - Log.Add(LogTypes.System, -1, string.Format("{0} while trying to build DTD for Xml schema; is Umbraco installed correctly and the connection string configured?", exception.Message)); + LogHelper.Error("Exception while trying to build DTD for Xml schema; is Umbraco installed correctly and the connection string configured?", exception); } } diff --git a/src/umbraco.cms/businesslogic/workflow/Notification.cs b/src/umbraco.cms/businesslogic/workflow/Notification.cs index 8240efa835..69fb4cd150 100644 --- a/src/umbraco.cms/businesslogic/workflow/Notification.cs +++ b/src/umbraco.cms/businesslogic/workflow/Notification.cs @@ -56,9 +56,7 @@ namespace umbraco.cms.businesslogic.workflow { if (!u.Disabled && u.GetNotifications(Node.Path).IndexOf(Action.Letter.ToString()) > -1) { - Log.Add(LogTypes.Notify, User.GetUser(0), Node.Id, - "Notification about " + ui.Text(Action.Alias, u) + " sent to " + u.Name + " (" + u.Email + - ")"); + LogHelper.Debug(string.Format("Notification about {0} sent to {1} ({2})", ui.Text(Action.Alias, u), u.Name, u.Email)); sendNotification(user, u, (Document)Node, Action); } } diff --git a/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs b/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs index 6c0927e740..4244043f03 100644 --- a/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs +++ b/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs @@ -348,12 +348,6 @@ namespace umbraco.editorControls.tinyMCE3 if (parsedString.StartsWith("
") && parsedString.EndsWith("
")) parsedString = parsedString.Substring("
".Length, parsedString.Length - "
".Length); } - else - { - // TODO - // How to log errors? _data.NodeId does not exist? - //BusinessLogic.Log.Add(BusinessLogic.LogTypes.Error, BusinessLogic.User.GetUser(0), _data.NodeId, "Error tidying txt from property: " + _data.PropertyId.ToString()); - } } // rescue umbraco tags