Пример #1
0
        public GemConfiguration Load(string path)
        {
            XDocument doc   = new XDocument();
            var       Write = new ActionAppender(GemNetworkDebugger.Echo);

            try
            {
                var gemConfig =
                    XDocument.Load(path)
                    .Element("Gem")
                    .Descendants("Network")
                    .Select(x => new GemConfiguration
                {
                    Factory        = x.Element("Factory").Value,
                    RuntimeBuilder = x.Element("RuntimeBuilder").Value
                })
                    .Single();

                GemNetworkDebugger.Append.Info("Network configuration loaded successfully");
                return(gemConfig);
            }
            catch (Exception ex)
            {
                GemNetworkDebugger.Append.Error(@"Failed to load Network configuration.
                                      Falling back to the default settings. Reason: {0}", ex.Message);

                return(new GemConfiguration {
                    Factory = "default", RuntimeBuilder = "default"
                });
            }
        }
Пример #2
0
    public static void Init()
    {
        var target = new ActionAppender
        {
            Action = _ => LastMessage = _.RenderedMessage
        };


        BasicConfigurator.Configure(target);
    }
    public static void ConfigureLogging()
    {
        var hierarchy = (Hierarchy)log4netLogManager.GetRepository();
        hierarchy.Root.RemoveAllAppenders();

        var target = new ActionAppender
        {
            Action = x => LoggingEvents.Add(x)
        };
        BasicConfigurator.Configure(target);
        NsbLogManager.Use<Log4NetFactory>();
    }
Пример #4
0
    public static void Init()
    {
        var target = new ActionAppender
        {
            Action = _ => LastMessage = _.RenderedMessage
        };

        var executingAssembly = Assembly.GetExecutingAssembly();
        var repository        = log4net.LogManager.GetRepository(executingAssembly);

        BasicConfigurator.Configure(repository, target);
    }
    public static void Init()
    {

        var target = new ActionAppender
            {
                Action = _ => LastMessage = _.RenderedMessage
            };


        BasicConfigurator.Configure(target);

    }
Пример #6
0
    public Log4NetTests()
    {
        AppDomainAssemblyFinder.Attach();
        beforeAssemblyPath = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\Log4NetAssemblyToProcess\bin\Debug\Log4NetAssemblyToProcess.dll"));
#if (!DEBUG)
        beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release");
#endif
        afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath);
        assembly          = Assembly.LoadFile(afterAssemblyPath);
        var hierarchy = (Hierarchy)LogManager.GetRepository();
        hierarchy.Root.RemoveAllAppenders();

        var target = new ActionAppender
        {
            Action = LogEvent
        };
        BasicConfigurator.Configure(target);
    }
Пример #7
0
    public Log4NetTests()
    {
        beforeAssemblyPath = Path.GetFullPath(@"..\..\..\Log4NetAssemblyToProcess\bin\Debug\Log4NetAssemblyToProcess.dll");
        #if (!DEBUG)
        beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release");
        #endif
        afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath);
        assembly = Assembly.LoadFile(afterAssemblyPath);
        var hierarchy = (Hierarchy)LogManager.GetRepository();
        hierarchy.Root.RemoveAllAppenders(); /*Remove any other appenders*/

        var target = new ActionAppender
        {
            Action = LogEvent
        };

        BasicConfigurator.Configure(target);
    }
Пример #8
0
    public Log4NetTests()
    {
        AppDomainAssemblyFinder.Attach();
        beforeAssemblyPath = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\Log4NetAssemblyToProcess\bin\Debug\Log4NetAssemblyToProcess.dll"));
#if (!DEBUG)
        beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release");
#endif
        afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath);
        assembly = Assembly.LoadFile(afterAssemblyPath);
        var hierarchy = (Hierarchy) LogManager.GetRepository();
        hierarchy.Root.RemoveAllAppenders();

        var target = new ActionAppender
        {
            Action = LogEvent
        };
        BasicConfigurator.Configure(target);
    }
Пример #9
0
    public Log4NetTests()
    {
        beforeAssemblyPath = Path.GetFullPath(@"..\..\..\Log4NetAssemblyToProcess\bin\Debug\Log4NetAssemblyToProcess.dll");
#if (!DEBUG)
        beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release");
#endif
        afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath);
        assembly          = Assembly.LoadFile(afterAssemblyPath);
        var hierarchy = (Hierarchy)LogManager.GetRepository();
        hierarchy.Root.RemoveAllAppenders(); /*Remove any other appenders*/

        var target = new ActionAppender
        {
            Action = LogEvent
        };


        BasicConfigurator.Configure(target);
    }
Пример #10
0
    static Log4NetTests()
    {
        var moduleWeaver = new ModuleWeaver();

        assembly = moduleWeaver.ExecuteTestRun(
            assemblyPath: "AssemblyToProcess.dll",
            ignoreCodes: new[] { "0x80131869" }).Assembly;
        var loggerRepository = LogManager.GetRepository(typeof(Log4NetTests).Assembly);
        var hierarchy        = (Hierarchy)loggerRepository;

        hierarchy.Root.RemoveAllAppenders();

        var target = new ActionAppender
        {
            Action = LogEvent
        };

        BasicConfigurator.Configure(loggerRepository, target);
    }