Archive for March, 2011

Only First External Javascript File Loads

March 14, 2011

Spent this morning chasing my tail on this one.

We use SexyLightBox as our preferred overlay in all our Web Apps. I was instructed to go to the code vault, disinter a never released app., hose it off, put a new pair of trousers on it and otherwise make it presentable for release, which meant incorporating SexyLightBox v2.2 into it. SexyLightBox 2.2 which is a JQuery PlugIn has a dependency on another Plugin called ‘Easing’..

The sick thing was, I could only get one of these Plugins to load into the browser at any one time. If I put jquery.easing.1.3.js first in the head tag, then it would load, but not sexylightbox.v2.2.jquery.js and if I put sexylightbox first then jquery.easing would not load.

The solution, so simple it makes my teeth ache, was that I had closed my script tags using the shorthand notion , simply using / instead of longhand using /script as beautifully described here, at the Brain Of Dave.

That’s all there is to it. All homage to the Brain Of Dave.

Log4Net Logs Not Generated, No AssemblyInfo.cs, WebSite Project

March 9, 2011

Today I had to implement Log4Net logging for my website. Using the lessons I had learned in my previous Journey Of Pain setting up log4net for a Console Application (see previous post) I figured this would be a doddle. Not so. Once again my logger failed to find any appenders.

Because my site is a VS WebSite Project and not a Web Project, it does not have an AssemblyInfo file, which is the normal place you would put your XmlConfigurator. So I put the call to XmlConfigurator.Configure in Global.asax Application_Start as suggested by Apache. No dice. Ot should I say once again, no Appenders and definitely no logging.

Googling hither and thither the core temperature of my liver reached Chernobyl proportions before I staggered blindly into the Googleistic revelation that log4net default configuration has a bug where AssemblyInfo is not present, as is the case for all Website projects (as opposed to Web Projects).

To overcome this bug you must move your log4net config to an external file and use the magic ApplicationSetting key ‘log4net.Config’ in web.config. The Stack Overflow contribuor Precipitous provided the necessary balm to my self-combusting liver in his post to Stack Overflow on the subject log4net in external file does not work.

The fix, in summary, create an external log4net config file, but leave the log4net section handler in your web.config, and add this Application Key add key=”log4net.Config” value=”your-path-here” .

Now relax, settle back, and watch this video of the Prime Minister Of Australia eating his ear wax.