Removed untyped contructor from ComponentRegistration and add a protected setter.
[castle.git] / Services / Logging / Castle.Services.Logging.log4netIntegration / ExtendedLog4netLogger.cs
blobcf4b784692e9e60eba0cec236a8cc8e074d23239
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.Services.Logging.Log4netIntegration
17 using System;
18 using Castle.Core.Logging;
19 using log4net;
20 using ILogger=log4net.Core.ILogger;
21 using Logger = Castle.Core.Logging.ILogger;
22 using ExtendedLogger = Castle.Core.Logging.IExtendedLogger;
24 public class ExtendedLog4netLogger : Log4netLogger, ExtendedLogger
26 private static readonly IContextProperties threadContextProperties = new ThreadContextProperties();
27 private static readonly IContextProperties globalContextProperties = new GlobalContextProperties();
28 private static readonly IContextStacks threadContextStacks = new ThreadContextStacks();
30 private ExtendedLog4netFactory factory;
32 public ExtendedLog4netLogger(ILog log, ExtendedLog4netFactory factory) : this(log.Logger, factory)
36 public ExtendedLog4netLogger(ILogger logger, ExtendedLog4netFactory factory)
38 Logger = logger;
39 Factory = factory;
42 public override Logger CreateChildLogger(String name)
44 return CreateExtendedChildLogger(name);
47 public ExtendedLogger CreateExtendedChildLogger(string name)
49 return Factory.Create(Logger.Name + "." + name);
52 protected internal new ExtendedLog4netFactory Factory
54 get { return factory; }
55 set { factory = value; }
58 #region IExtendedLogger Members
60 /// <summary>
61 /// Exposes the Global Context of the extended logger.
62 /// </summary>
63 public IContextProperties GlobalProperties
65 get { return globalContextProperties; }
68 /// <summary>
69 /// Exposes the Thread Context of the extended logger.
70 /// </summary>
71 public IContextProperties ThreadProperties
73 get { return threadContextProperties; }
76 /// <summary>
77 /// Exposes the Thread Stack of the extended logger.
78 /// </summary>
79 public IContextStacks ThreadStacks
81 get { return threadContextStacks; }
84 #endregion