Archive

Archive for the ‘Infrastructure’ Category

Sitecore Logging – Log4Net – CastleWindsor

As most of you probably already know, Sitecore (until 6.6.0) use an old version of Log4Net in the Sitecore.Logging assembly, you can read more about this issue here

So there are 2 options:

1) Use Sitecore Logging as your logging strategy

2) Use CastleWindsor Logging facilities

In order to implement the second option you have to:

Implement your logging facility:

public class  XXXContainerInstaller : IWindsorInstaller
{
public void Install(Castle.Windsor.IWindsorContainer container,
Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
{

//Load your Custom Configuration from a different config “using a more advanced pattern expression

container.AddFacility<Castle.Facilities.Logging.LoggingFacility>(f => f.LogUsing(LoggerImplementation.Log4net).WithConfig(“log4net.xml”));

container.Register(
Component.For<XXXX.ILoggingSetup>()
.Named(“loggingSetup”)
.ImplementedBy<XXXX.Log4net.Log4NetLoggingSetup>()
.LifeStyle.Singleton,

}

}

Prepare your config:

<castle>
<facilities>
<facility id=”logging” type=”Castle.Facilities.Logging.LoggingFacility, Castle.Facilities.Logging” loggingApi=”log4net”/>
</facilities>
<components>
<component id=”loggingSetup” service=”XXX.ILoggingSetup, AssemblyName” type=”XXXX.Log4NetLoggingSetup, Asos.Framework” lifestyle=”AssemblyName”/>
<component id=”loggingContext” service=”XXX.ILoggingContext, AssemblyName” type=”XXXX.Log4NetLoggingContext, AssemblyName” lifestyle=”singleton”/>
</components>
</castle>

The Log4Net Section will still be required and shared between your Castle Logging and SiteCore Logging…

<section name=”log4net” type=”log4net.Config.Log4NetConfigurationSectionHandler, log4net”/>

<log4net>
<appender name=”eventLogAppender” type=”log4net.Appender.EventLogAppender, log4net” logName=”Application”>
<param name=”LogName” value=”Application”/>
<param name=”ApplicationName” value=”XXXXX”/>
<layout type=”log4net.Layout.PatternLayout”>
<conversionPattern value=”%appdomain [%thread] %-5level – %message%newline [%properties]%newline %exception”/>
</layout>
</appender>
<root>
<level value=”ERROR”/>
<appender-ref ref=”eventLogAppender”/>
</root>
</log4net>

Be also aware that the SitecoreLogging does not support the latest log4net formatting syntax like %exception

and Sitecore formatting expression prefer the OldLog4Net syntax with all abbreviated letters

<conversionPattern value=”%4t %d{ABSOLUTE} %-5p %m%n” />

More references about this issue can be found:

http://devlicio.us/blogs/casey/archive/2008/06/18/logging-with-castle-windsor-the-logging-facility-and-log4net.aspx

http://damikulik.blogspot.co.uk/2011/05/integrate-sitecorelogging-with-castle.html

How To Create a Custom Culture in Sitecore

1) Create a culture on the server and register it

http://msdn.microsoft.com/en-us/library/ms172469(v=vs.80).aspx

CultureAndRegionInfoBuilder cib = new CultureAndRegionInfoBuilder( “x-en-US-sample”, CultureAndRegionModifiers.None);

CultureInfo ci = new CultureInfo(“en-US”);

cib.LoadDataFromCultureInfo(ci);

cib.Register();

2) Install a custom culture (copy files and deploy registry keys)
http://msdn.microsoft.com/en-us/library/ms404375(v=vs.85).aspx

3) Create Icon files (for the right sizes in Sitecore)

4) Compress the Icon in a zip file

in the folder sitecore\shell\Themes\Standard\CustomFlags.zip

4) Create Custom Language in Sitecore (specifying dictionary, iso codes etc)

image

Categories: DEV, Infrastructure Tags: , ,

Setup SQL 2008 unattended mode

SQLEXPR_x86_ENU.exe /q

/ACTION=Install 

/INSTANCEID="AEEXPRESS"

/INSTANCENAME="AEEXPRESS"

/FEATURES=SQLENGINE,CONN 

/SQLSVCACCOUNT="NT AUTHORITY\SYSTEM" 

/SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS"

/SQLSVCSTARTUPTYPE="Automatic"

/SECURITYMODE=SQL

/SAPWD=Password01

http://msdn.microsoft.com/en-us/library/ms144259%28v=sql.100%29.aspx#Install

Categories: Infrastructure Tags: ,

MimeTypes for standard video files

<system.webServer>
 <validation validateIntegratedModeConfiguration="false"/> 
<modules runAllManagedModulesForAllRequests="true"/> 
<staticContent> 

<mimeMap fileExtension=".mp4" mimeType="video/mp4" /> 
<mimeMap fileExtension=".ogg" mimeType="audio/ogg" /> 
<mimeMap fileExtension=".oga" mimeType="audio/ogg" /> 
<mimeMap fileExtension=".ogv" mimeType="video/ogg" /> 
<mimeMap fileExtension=".webm" mimeType="video/webm" /> 

</staticContent>
 </system.webServer> 
Categories: Infrastructure Tags: ,

ReProvisioning of Sharepoint WebSites

Do you need to ReProvision your Sharepoint Sites in your farm???

stsadm -o provisionservice -action start -servicetype spwebservice

Categories: Infrastructure

how to script an FTP upload in a BAT file

In several projects you have the need to automate your deployment procedures… unfortunately often your code is hosted by an external provider that for security reasons give you the access only with FTP…

This code is perfect to automate the upload of your deployment package.

1) Create a Bat File with the following code and name it Upload.bat

@echo off
echo user FTPUserName> ftpcmd.dat
echo FTPPWD >> ftpcmd.dat
echo cd FolderName >>ftpcmd.dat
echo bin>> ftpcmd.dat
echo put %1>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat FTPserverURL
del ftpcmd.dat

as you can understand you have to put into your username and password and eventually the code to switch directory if you are going to upload something on the root…

2) call your bat file with the following syntax: upload.bat testFile.zip

Happy scripting to everybody Smile

Categories: DEV, Infrastructure Tags: ,

Source Control on Mercurial

There are several tools available for Mercurial…

On my last project we have decided to migrate to Mercurial from TFS and we are enjoying the following technologies stack:

Mercurial – Bitbucket– Jira – TeamCity

How can you do all of this???

Jira with the agile plugin is an excellent tool to run an Agile project, and you can integrate it fairly easily with Mercurial…

TeamCity can be also integrated fairly easily with Mercurial to keep under control build and deployment processes

Bitbucket is the connector to see your Mercurial repository “onLine”

as useful tools, I would also recommend TortoiseHG and VisualHG and Jira Connector for VS

these are few command to remember in the everyday life using mercurial…

How to switch Branch: HG update "default"

TFS CheckIn
hg push 

TFS get latest
hg pull 

after pull sometime hg up o hg update

hg merge to mix changes after a pull

how to download an existing repository from bitbucket
hg clone https://username@bitbucket.org/repCreator/projectName

TO KNOW ALL THE EXISTING BRANCHES
hg branches