Over a million developers have joined DZone.

Layer Level Logging

·

Our projects design as modular, layered   in order to reduce development process and spent time.So our solution design become more simple, can be controled.You can use in below code stucture for especially enterprise solutions in projects with a lot of  logical layer.

Let’s take a look our enterprise codes.


gist link ; https://gist.github.com/yemrekeskin/5613861#file-layerlevellogging-cs

/// 
/// possible layers
/// 
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"; } }
}
 
/// 
///  loging library : Log4net
/// 
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));
        }
    }
}
Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}