I have a problem with setting the rollInterval to “Midnight” of the RollingFlatFileTraceListenerUPS GetRate() Shipping Server Error LogWhy getting System.Net.Http.HttpRequestException when run my application in windows 7Building a Windows Service with .NET 4.5Exceptions in System.Runtime.CompilerServices.AsyncServices without my code in stack traceRoleEnvironmentException When Deploying Worker Role To AzureWPF: Investigate WPF app crash by unhandled exceptionsError in Rx runtimePInvoke null reference exception on Marshal.PtrToStructure<T>(ptr)wpf application runs in debug mode but doesn't run without debuggingHow to init mvvmcross forms IoC in android job service to use registered services when app is close?

Why don't modern jet engines use forced exhaust mixing?

Can a countable set contain uncountably many infinite subsets such that the symmetric difference of any two such distinct subsets is finite?

Is there any official ruling on how characters go from 0th to 1st level in a class?

Quick destruction of a helium filled airship?

What should I do with the stock I own if I anticipate there will be a recession?

Unconventional examples of mathematical modelling

Output with the same length always

What are some tips and tricks for finding the cheapest flight when luggage and other fees are not revealed until far into the booking process?

Is nullptr falsy?

How do I answer an interview question about how to handle a hard deadline I won't be able to meet?

A Magic Diamond

6502: is BCD *fundamentally* the same performance as non-BCD?

How to prevent criminal gangs from making/buying guns?

What if a restaurant suddenly cannot accept credit cards, and the customer has no cash?

What modifiers are added to the attack and damage rolls of this unique longbow from Waterdeep: Dragon Heist?

How do I pass a "list of lists" as the argument to a function of the form F[x,y]?

Output the list of musical notes

Are there any cons in using rounded corners for bar graphs?

Can I use my OWN published papers' images in my thesis without Copyright infringment

How to gracefully leave a company you helped start?

Adding things to bunches of things vs multiplication

Have there ever been other TV shows or Films that told a similiar story to the new 90210 show?

Why does Japan use the same type of AC power outlet as the US?

Is there a way, other than having a Diviner friend, for a player to avoid rolling Initiative at the start of a combat?



I have a problem with setting the rollInterval to “Midnight” of the RollingFlatFileTraceListener


UPS GetRate() Shipping Server Error LogWhy getting System.Net.Http.HttpRequestException when run my application in windows 7Building a Windows Service with .NET 4.5Exceptions in System.Runtime.CompilerServices.AsyncServices without my code in stack traceRoleEnvironmentException When Deploying Worker Role To AzureWPF: Investigate WPF app crash by unhandled exceptionsError in Rx runtimePInvoke null reference exception on Marshal.PtrToStructure<T>(ptr)wpf application runs in debug mode but doesn't run without debuggingHow to init mvvmcross forms IoC in android job service to use registered services when app is close?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'am using the Enterprise Library Logging Application Block Version 6.0 in an application. Today the application crashed at midnight as recoreded in the Event log.




Timestamp: 2019-03-27 00:00:00



Exception Info: System.NullReferenceException
at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener+StreamWriterRollingHelper.PerformRoll(System.DateTime)
at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener+StreamWriterRollingHelper.RollIfNecessary()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.TimerQueueTimer.CallCallback()




Setting of the RollingFlatFileTraceListener from the app.config



<add name="Flat File Destination" 
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging"
fileName="trace.log"
footer=""
formatter="Text Formatter"
header=""
rollFileExistsBehavior="Increment"
rollInterval="Midnight"
rollSizeKB="50000"
timeStampPattern="yyyy-MM-dd"
maxArchivedFiles="10"
traceOutputOptions="None"
filter="All" />


There are log entries in the trace file milliseconds before and after midnight. So there must be Access to the trace file while it is rolled.



I wrote a small test Programm to stress the application logger with the same Settings from my crashed application. While the app was running I often changed the time to some seconds before midnight trying to replicate the exception but was not successfull.



I opened the assemblies of the logging application in Version 5.0 and 6.0.
In Version 6.0 the RollingFlatFileTraceListener has the following constructor:



public RollingFlatFileTraceListener(string fileName, string header = "----------------------------------------", string footer = "----------------------------------------", ILogFormatter formatter = null, int rollSizeKB = 0, string timeStampPattern = "yyyy-MM-dd", RollFileExistsBehavior rollFileExistsBehavior = 0, RollInterval rollInterval = 0, int maxArchivedFiles = 0) : base(fileName, header, footer, formatter)

Guard.ArgumentNotNullOrEmpty(fileName, "fileName");
this.rollSizeInBytes = rollSizeKB * 1024;
this.timeStampPattern = timeStampPattern;
this.rollFileExistsBehavior = rollFileExistsBehavior;
this.rollInterval = rollInterval;
this.maxArchivedFiles = maxArchivedFiles;
this.rollingHelper = new RollingFlatFileTraceListener.StreamWriterRollingHelper(this);
if (rollInterval == RollInterval.Midnight)

DateTime currentDateTime = this.rollingHelper.DateTimeProvider.CurrentDateTime;
DateTime date = currentDateTime.AddDays(1).Date;
this.timer = new Timer((object o) => this.rollingHelper.RollIfNecessary(), null, date.Subtract(currentDateTime), TimeSpan.FromDays(1));




So with the Setting of the rolling interval to Midnight a separate timer is started to perform the Rolling of the trace file if it is necessary. That was not the case in V5.0.



The method RollIfNecessary is also called by the method TraceData. My assumption is, that there is a threading issue when the method RollIfNecessary is executed. I found no lock in this method.



Can someone confirm my suspicion or had similar Problems?










share|improve this question






























    0















    I'am using the Enterprise Library Logging Application Block Version 6.0 in an application. Today the application crashed at midnight as recoreded in the Event log.




    Timestamp: 2019-03-27 00:00:00



    Exception Info: System.NullReferenceException
    at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener+StreamWriterRollingHelper.PerformRoll(System.DateTime)
    at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener+StreamWriterRollingHelper.RollIfNecessary()
    at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    at System.Threading.TimerQueueTimer.CallCallback()




    Setting of the RollingFlatFileTraceListener from the app.config



    <add name="Flat File Destination" 
    type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging"
    listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging"
    fileName="trace.log"
    footer=""
    formatter="Text Formatter"
    header=""
    rollFileExistsBehavior="Increment"
    rollInterval="Midnight"
    rollSizeKB="50000"
    timeStampPattern="yyyy-MM-dd"
    maxArchivedFiles="10"
    traceOutputOptions="None"
    filter="All" />


    There are log entries in the trace file milliseconds before and after midnight. So there must be Access to the trace file while it is rolled.



    I wrote a small test Programm to stress the application logger with the same Settings from my crashed application. While the app was running I often changed the time to some seconds before midnight trying to replicate the exception but was not successfull.



    I opened the assemblies of the logging application in Version 5.0 and 6.0.
    In Version 6.0 the RollingFlatFileTraceListener has the following constructor:



    public RollingFlatFileTraceListener(string fileName, string header = "----------------------------------------", string footer = "----------------------------------------", ILogFormatter formatter = null, int rollSizeKB = 0, string timeStampPattern = "yyyy-MM-dd", RollFileExistsBehavior rollFileExistsBehavior = 0, RollInterval rollInterval = 0, int maxArchivedFiles = 0) : base(fileName, header, footer, formatter)

    Guard.ArgumentNotNullOrEmpty(fileName, "fileName");
    this.rollSizeInBytes = rollSizeKB * 1024;
    this.timeStampPattern = timeStampPattern;
    this.rollFileExistsBehavior = rollFileExistsBehavior;
    this.rollInterval = rollInterval;
    this.maxArchivedFiles = maxArchivedFiles;
    this.rollingHelper = new RollingFlatFileTraceListener.StreamWriterRollingHelper(this);
    if (rollInterval == RollInterval.Midnight)

    DateTime currentDateTime = this.rollingHelper.DateTimeProvider.CurrentDateTime;
    DateTime date = currentDateTime.AddDays(1).Date;
    this.timer = new Timer((object o) => this.rollingHelper.RollIfNecessary(), null, date.Subtract(currentDateTime), TimeSpan.FromDays(1));




    So with the Setting of the rolling interval to Midnight a separate timer is started to perform the Rolling of the trace file if it is necessary. That was not the case in V5.0.



    The method RollIfNecessary is also called by the method TraceData. My assumption is, that there is a threading issue when the method RollIfNecessary is executed. I found no lock in this method.



    Can someone confirm my suspicion or had similar Problems?










    share|improve this question


























      0












      0








      0








      I'am using the Enterprise Library Logging Application Block Version 6.0 in an application. Today the application crashed at midnight as recoreded in the Event log.




      Timestamp: 2019-03-27 00:00:00



      Exception Info: System.NullReferenceException
      at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener+StreamWriterRollingHelper.PerformRoll(System.DateTime)
      at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener+StreamWriterRollingHelper.RollIfNecessary()
      at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
      at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
      at System.Threading.TimerQueueTimer.CallCallback()




      Setting of the RollingFlatFileTraceListener from the app.config



      <add name="Flat File Destination" 
      type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging"
      listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging"
      fileName="trace.log"
      footer=""
      formatter="Text Formatter"
      header=""
      rollFileExistsBehavior="Increment"
      rollInterval="Midnight"
      rollSizeKB="50000"
      timeStampPattern="yyyy-MM-dd"
      maxArchivedFiles="10"
      traceOutputOptions="None"
      filter="All" />


      There are log entries in the trace file milliseconds before and after midnight. So there must be Access to the trace file while it is rolled.



      I wrote a small test Programm to stress the application logger with the same Settings from my crashed application. While the app was running I often changed the time to some seconds before midnight trying to replicate the exception but was not successfull.



      I opened the assemblies of the logging application in Version 5.0 and 6.0.
      In Version 6.0 the RollingFlatFileTraceListener has the following constructor:



      public RollingFlatFileTraceListener(string fileName, string header = "----------------------------------------", string footer = "----------------------------------------", ILogFormatter formatter = null, int rollSizeKB = 0, string timeStampPattern = "yyyy-MM-dd", RollFileExistsBehavior rollFileExistsBehavior = 0, RollInterval rollInterval = 0, int maxArchivedFiles = 0) : base(fileName, header, footer, formatter)

      Guard.ArgumentNotNullOrEmpty(fileName, "fileName");
      this.rollSizeInBytes = rollSizeKB * 1024;
      this.timeStampPattern = timeStampPattern;
      this.rollFileExistsBehavior = rollFileExistsBehavior;
      this.rollInterval = rollInterval;
      this.maxArchivedFiles = maxArchivedFiles;
      this.rollingHelper = new RollingFlatFileTraceListener.StreamWriterRollingHelper(this);
      if (rollInterval == RollInterval.Midnight)

      DateTime currentDateTime = this.rollingHelper.DateTimeProvider.CurrentDateTime;
      DateTime date = currentDateTime.AddDays(1).Date;
      this.timer = new Timer((object o) => this.rollingHelper.RollIfNecessary(), null, date.Subtract(currentDateTime), TimeSpan.FromDays(1));




      So with the Setting of the rolling interval to Midnight a separate timer is started to perform the Rolling of the trace file if it is necessary. That was not the case in V5.0.



      The method RollIfNecessary is also called by the method TraceData. My assumption is, that there is a threading issue when the method RollIfNecessary is executed. I found no lock in this method.



      Can someone confirm my suspicion or had similar Problems?










      share|improve this question














      I'am using the Enterprise Library Logging Application Block Version 6.0 in an application. Today the application crashed at midnight as recoreded in the Event log.




      Timestamp: 2019-03-27 00:00:00



      Exception Info: System.NullReferenceException
      at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener+StreamWriterRollingHelper.PerformRoll(System.DateTime)
      at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener+StreamWriterRollingHelper.RollIfNecessary()
      at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
      at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
      at System.Threading.TimerQueueTimer.CallCallback()




      Setting of the RollingFlatFileTraceListener from the app.config



      <add name="Flat File Destination" 
      type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging"
      listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging"
      fileName="trace.log"
      footer=""
      formatter="Text Formatter"
      header=""
      rollFileExistsBehavior="Increment"
      rollInterval="Midnight"
      rollSizeKB="50000"
      timeStampPattern="yyyy-MM-dd"
      maxArchivedFiles="10"
      traceOutputOptions="None"
      filter="All" />


      There are log entries in the trace file milliseconds before and after midnight. So there must be Access to the trace file while it is rolled.



      I wrote a small test Programm to stress the application logger with the same Settings from my crashed application. While the app was running I often changed the time to some seconds before midnight trying to replicate the exception but was not successfull.



      I opened the assemblies of the logging application in Version 5.0 and 6.0.
      In Version 6.0 the RollingFlatFileTraceListener has the following constructor:



      public RollingFlatFileTraceListener(string fileName, string header = "----------------------------------------", string footer = "----------------------------------------", ILogFormatter formatter = null, int rollSizeKB = 0, string timeStampPattern = "yyyy-MM-dd", RollFileExistsBehavior rollFileExistsBehavior = 0, RollInterval rollInterval = 0, int maxArchivedFiles = 0) : base(fileName, header, footer, formatter)

      Guard.ArgumentNotNullOrEmpty(fileName, "fileName");
      this.rollSizeInBytes = rollSizeKB * 1024;
      this.timeStampPattern = timeStampPattern;
      this.rollFileExistsBehavior = rollFileExistsBehavior;
      this.rollInterval = rollInterval;
      this.maxArchivedFiles = maxArchivedFiles;
      this.rollingHelper = new RollingFlatFileTraceListener.StreamWriterRollingHelper(this);
      if (rollInterval == RollInterval.Midnight)

      DateTime currentDateTime = this.rollingHelper.DateTimeProvider.CurrentDateTime;
      DateTime date = currentDateTime.AddDays(1).Date;
      this.timer = new Timer((object o) => this.rollingHelper.RollIfNecessary(), null, date.Subtract(currentDateTime), TimeSpan.FromDays(1));




      So with the Setting of the rolling interval to Midnight a separate timer is started to perform the Rolling of the trace file if it is necessary. That was not the case in V5.0.



      The method RollIfNecessary is also called by the method TraceData. My assumption is, that there is a threading issue when the method RollIfNecessary is executed. I found no lock in this method.



      Can someone confirm my suspicion or had similar Problems?







      c# logging nullreferenceexception enterprise-library logging-application-block






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 12:32









      AFruehAFrueh

      62 bronze badges




      62 bronze badges

























          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377290%2fi-have-a-problem-with-setting-the-rollinterval-to-midnight-of-the-rollingflatf%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377290%2fi-have-a-problem-with-setting-the-rollinterval-to-midnight-of-the-rollingflatf%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript