Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Leo 1 post 71 karma points
    Nov 28, 2016 @ 22:15
    Leo
    0

    "umbraco.BusinessLogic.Log - Log scrubbed" and 1 minute delay

    Hello,

    I started my first website using 7.5.4 with SQLCE database on shared hosting. Every time Umbraco app is started after shutdown, I see in log file the following (part of log):

    2016-11-28 12:33:02,576 [P744308/D46/T35] INFO  Umbraco.Core.DatabaseContext - CanConnect = True
     2016-11-28 12:33:03,231 [P744308/D46/T35] INFO  Umbraco.Core.DatabaseContext - CanConnect = True
     2016-11-28 12:33:03,309 [P744308/D46/T35] INFO  Umbraco.Core.DatabaseContext - CanConnect = True
     2016-11-28 12:33:03,512 [P744308/D46/T35] INFO  Umbraco.Web.Cache.CacheRefresherEventHandler - Initializing Umbraco internal event handlers for cache refreshing
     2016-11-28 12:33:03,715 [P744308/D46/T35] INFO  Umbraco.Web.Search.ExamineEvents - Initializing Examine and binding to business logic events
     2016-11-28 12:33:03,715 [P744308/D46/T35] INFO  Umbraco.Web.Search.ExamineEvents - Adding examine event handlers for index providers: 3
     2016-11-28 12:33:03,747 [P744308/D46/T35] INFO  Umbraco.Core.CoreBootManager - Umbraco application startup complete (took 3859ms)
     2016-11-28 12:33:04,075 [P744308/D46/T418] INFO  Umbraco.Core.Sync.ApplicationUrlHelper - ApplicationUrl: http://speedtraps.com.milfoil.arvixe.com:80/umbraco (UmbracoModule request)
     2016-11-28 12:33:05,012 [P744308/D46/T418] INFO  umbraco.content - Load Xml from file...
     2016-11-28 12:33:05,012 [P744308/D46/T418] INFO  umbraco.content - Loaded Xml from file.
     2016-11-28 12:33:06,559 [P744308/D46/T418] INFO  Umbraco.Core.PluginManager - Starting resolution types of Umbraco.Core.PropertyEditors.IParameterEditor
     2016-11-28 12:33:06,559 [P744308/D46/T418] INFO  Umbraco.Core.PluginManager - Completed resolution of types of Umbraco.Core.PropertyEditors.IParameterEditor, found 0 (took 1ms)
     2016-11-28 12:34:05,152 [P744308/D46/T481] INFO  umbraco.BusinessLogic.Log - Log scrubbed.  Removed all items older than 2016-11-27 12:34:05
     2016-11-28 12:34:05,308 [P744308/D46/T731] INFO  Umbraco.Core.PluginManager - Starting resolution types of Umbraco.Core.Persistence.Mappers.BaseMapper
    

    BusinessLogic.Log scrubbing takes 59 seconds (2nd log line from bottom). I looked Umbraco sources.

    public static void CleanLogs(int maximumAgeOfLogsInMinutes) 
    { 
        if (Instance.ExternalLogger != null) 
            Instance.ExternalLogger.CleanLogs(maximumAgeOfLogsInMinutes); 
        else 
        { 
            try 
            { 
                DateTime oldestPermittedLogEntry = DateTime.Now.Subtract(new TimeSpan(0, maximumAgeOfLogsInMinutes, 0)); 
                var formattedDate = oldestPermittedLogEntry.ToString("yyyy-MM-dd HH:mm:ss"); 
    
                using (var sqlHelper = Application.SqlHelper) 
                    sqlHelper.ExecuteNonQuery("delete from umbracoLog where datestamp < @oldestPermittedLogEntry and logHeader in ('open','system')", 
                    sqlHelper.CreateParameter("@oldestPermittedLogEntry", oldestPermittedLogEntry)); 
    
                LogHelper.Info<Log>(string.Format("Log scrubbed.  Removed all items older than {0}", formattedDate)); 
            } 
            catch (Exception e) 
            { 
                Debug.WriteLine(e.ToString(), "Error"); 
                Trace.WriteLine(e.ToString()); 
            } 
        } 
    }
    

    It seems, that this is a scrubbing code and the only place which can give such delay is: sqlHelper.ExecuteNonQuery(...). But it is hard to believe that this sql-query can take 1 minute. My umbracoLog table has less than 1000 rows. What is interesting, delay is always exactly 59 seconds. Not random times like 55,50,59,70,65 from start to start. What could be reason? Application is shut down, but database file is still locked by system for writing? From other hand, first lines in log above tell that connection is established. And these strange constant 59 seconds.. After application start everything work perfectly, until next shutdown/start. So, advices will be much appreciated.

    Best regards, Leo

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies