Log4net rollingfile appender skipping every other day in asp.net mvc app - asp.net-mvc

I've set up some log4net logging on an asp.net mvc application i've had running for a little over a month now.
I've set up rolling file (and smtp) appender on it.
The application is hit several thousand times a day - alot of actions are logged. On top of these a number of batch jobs are run as part of the application that also write to the log.
Now - as i've been occupied with other work, i've not attended to this application much assuming things to be working based on my test setup.
Unfortunately i discover that the rolling file appender on my production server seems to be skipping every other day.
Ie i have logs :
10/4/2010,
10/4/2010.1,
10/4/2010.2,
12/4/2010,
12/4/2010.1 ,
14/4/2010,
14/4/2010.1
etc.
Any idea what could be causing this? It is absolutely impossible that there has no action on these odd days for the lifetime of the application.
Cheers

If your batch jobs are writing to the same files as the asp.net mvc app, then it might be a locking issue. Make sure that you have the minimal lock setting in all of your config files.

Related

Scheduled publication not working in Umbraco

I am using Umbraco 7.5.2, installed on a VM in Azure.
When a Publish At date is set, the page is never published. I have tried the following steps.
Create and publish a page
Unpublish the page
Set the Publish At date to a few minutes in the future and Save&Publish
Verified page is definitely not visible
Wait for the time to roll around, and even a few minutes more
Page is never published.
The following message appears in the logs on save when setting the publish at date, which is normal. But no other messages appear after and the page is never published.
2016-10-25 17:46:20,784 [P4808/D10/T21] INFO Umbraco.Core.Services.ContentService - Content 'Video1' with Id '1312' is awaiting release and could not be published.
I've made a copy of my production Umbraco folder and of the database ON THE SAME VM. That instance works for scheduled publishing.
I'm wondering if anyone can provide some clues as to what the issue could be or where I could look. I'd like to avoid having to migrate my production data to this test site.
Thanks
The problem may be related with different time-zone on azure VM as Umbraco is using server time to proceed inside the code execution. This should be the first thing to check.
In version 7.6.0 (https://our.umbraco.org/contribute/releases/760) it will be possible to set up server timezone and then set up a time with precise offset, so those type of problems shouldn't be seen then.
For me it was a wrong umbracoApplicationUrl path (it has to point to YOURDOMAIN/umbraco) After fixing this url everything started working fine
In addition to Marcin's answer, also check that the server can access itself, as it pings itself to fire the scheduled publishing. If it can't resolve it's own address, the scheduled publish will fail. It doesn't happen often, but I've seen a few VERY locked down installs where the server can't resolve it's own address.

Web deployment failing due to file in use

I'm using Microsoft's Web Deploy Remote Agent service to allow me to easily publish code to the server from within Visual Studio.
The web site I am deploying is using log4net to log messages to log files, and every time I try to deploy a new version of the code, I get this error in Visual Studio stating that the current log4net log file is in use:
An error occurred when the request was processed on the remote
computer. The file 'Web.log' is in use.
The process cannot access 'C:\inetpub\wwwroot\Logs\Web.log' because it
is being used by another process.
I can solve this by going onto the server and doing an iisreset before publishing... but that is kind of defeating the point of 'easy' publishing from Visual Studio :)
Is there some way I can get the publish task to issue an iisreset automatically, or some other way I can work round this?
I kept poking around and found some tidbits around the file being locked in a few other forums. Have you tried adding
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
To your <appender> element in the web.config file? From the Apache docs
Opens the file once for each AcquireLock/ReleaseLock cycle,
thus holding the lock for the minimal amount of time. This method of
locking is considerably slower than FileAppender.ExclusiveLock but
allows other processes to move/delete the log file whilst logging
continues.
As far as the performance considerations, I suppose you would need to test if this will affect you or not as I am assuming it really depends on how often you are writing to the log file as to how much this will impact performance. I can't believe that getting/releasing a lock could take all that much time though.
There is a MSDEPLOY provider called recycleApp which is used exactly for this. You can include this in your deployment manifest.
Another option is to use ignoreOnErrors flag which will skip the file in use and continue with the deployment.

What could cause my MVC apps to be incredibly slow to start?

Extremely often, in all kinds of various MVC3/4 apps I debug in VS2012 on my home machine, after pressing F5 to start debugging and open the configured start page in Chrome, it can take several - up to ten - minutes before becoming active.
I have no long startup procedures that load caches or generate code etc. and the same app will start instantly on my office machine. Quite often it will do so on my home machine as well, but this slow starting seems to come about after some hours of debugging, and possibly certain operations. Restarting VS doesn't seem to help, neither does killing IIS Express.
We were faced with an identical scenario recently where attaching the application to the debugger resulted in each page load taking about 10 minutes each, but running without debugging or in the QA environment worked fine.
The problem turned out to be that log4net was configured to use a network path for storing log files, a path that was unavailable from our local setup. This resulted in multiple attempts at accessing a remote path (once for each class being set up with Spring .Net) that didn't exist (and hence log4net threw an exception in each case).
But this should impact you out of the box, and shouldn't increase with time..

ASP.NET MVC failed to deploy on Windows Azure

I'm trying to upload an ASP.NET MVC 3.0 application to Windows Azure. The upload ok but the configuration (automatic operation just after upload) failed.
Any idea ? (I'm new in Windows Azure)
In the new portal you have to explicitly check a check box to allow deployment with less that two instances:
There is absolutely no obligation to use 2 instances. There is only SLA that comes into place only if you have 2 or more instances. I have production roles with 1 instance and I am very happy to use the Windows Azure services.
UPDATE
Just ntoed the "Linked Resources" comment on the first answer. So here are my 2 cents on it too: Linked resources feature is just a way for us developers to have a quick overview of our application and to quickly navigate between the components. There is nothing to do with our application's configuration files. You can set your Windows Azure SQL Database connection string as you normaly do with regular apps - in web.config (web.release.config)
The answer is right there in the second screen shot.
When you upload your package from the portal the dialog has a checkbox at the bottom that says "Deploy even if one or more roles contain a single instance" That needs to be checked if you are choosing to deploy to a single instance.
This is required since the SLA cannot be maintained with a single instance. There are times when the single instance needs to have OS updates applied or sometimes there are hardware failures. Having more than one instance is the only way to continue serving requests when one of these events occur.
You probably will not want to deploy a production solution with a single instance. But, for the dev cycle you can certainly get by with 1.

Struts dev.mode for a live site

In the struts documentation they are saying that by setting
<constant name="struts.devMode" value="true" />
This will cause the site to load fastly.
So my question is is it possible to put this constant in live site so that it will load the live site fastly. Is there any problem with that?
Thanks
You took it all wrong,struts.devMode when enabled, acts much friendlier, which can significantly speed up development.
When you have made the devMode=true in your config file this will help you in following steps
Struts 2 will reload your resource bundles on every request (meaning you can change your .properties files, save them, and see the changes reflected on the next request).
It will also reload your xml configuration files (struts.xml), your validation files, etc, on every request. This is useful for testing or finetuning your configuration, without having to redeploy your application every time.
it will raise the level of debug or normally ignorable problems to errors.
In Short it is a weapon for the developer for enhance his development process by figuring out any error, as when enabled it will show yo much friendly and detailed error underlying the cause and any suggestion.
Here are more details for devMode
Struts2 Development mode
It is never recommended to enabled this in your production as enabling this means you are reloading your configuration file /any other property files on each request which will definitely slow down the overall portal.
By default, the development mode is disabled, because it has a significant impact on performance, since the entire configuration will be reloaded on every request.
The development mode is only suitable in a development or debugging environment. In a production environment, you have to disable it. It will cause significant impact on performance, because the entire application configuration and properties files will be reloaded on every request and extra logging and debugging information will also be provided.

Resources