Archive for January, 2013

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”));




Prepare your config:

<facility id=”logging” type=”Castle.Facilities.Logging.LoggingFacility, Castle.Facilities.Logging” loggingApi=”log4net”/>
<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”/>

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

<section name=”log4net” type=”log4net.Config.Log4NetConfigurationSectionHandler, 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”/>
<level value=”ERROR”/>
<appender-ref ref=”eventLogAppender”/>

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:

How To Create a Custom Culture in Sitecore

1) Create a culture on the server and register it

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

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



2) Install a custom culture (copy files and deploy registry keys)

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\

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


Categories: DEV, Infrastructure Tags: , ,