To log what site that a specific message is generated by in a EPiServer Enterprise multi site you have to tell log4net what site the request is coming from – this can be done by setting a MDC variable when starting the request.
Global.asax
protected void Application_BeginRequest(object sender, EventArgs e)
{
MDC.Set("Site", Request.Url.Host);
}
EPiServerLog.config
<log4net>
...
<appender name="fileLogAppender" type="log4net.Appender.FileAppender" >
...
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %level [%thread] %X{Site} %type.%method - %message%n" />