public
Created

Layer Level Logging

  • Download Gist
LayerLevelLogging.cs
C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
/// <summary>
/// possible layers
/// </summary>
public abstract class LayerDefinitions
{
public static string ServiceHostLayer { get { return "Sample.Service.Host"; } }
public static string ServiceRepositorylayer { get { return "Sample.Service.Repository"; } }
public static string CommonRepositorylayer { get { return "Sample.Common.Repository"; } }
public static string DataAccessLayer { get { return "Sample.DataAccess"; } }
public static string WebSecurityLayer { get { return "Sample.WebSecurity"; } }
public static string CoreLayer { get { return "Sample.Core"; } }
public static string UtilLayer { get { return "Sample.Util"; } }
}
 
/// <summary>
/// loging library : Log4net
/// </summary>
public class LoggerService
{
public static log4net.ILog Log
{
get
{
return log4net.LogManager
.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
}
}
public static void Setup(HttpContext context)
{
string path = context.Server.MapPath("log4net.config");
if (File.Exists(path))
{
log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(path));
}
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.