zhao
2021-07-19 8347f2fbddbd25369359dcb2da1233ac48a19fdc
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more 
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership. 
// The ASF licenses this file to you under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with 
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
 
using System;
using System.Collections;
 
using log4net.Appender;
using log4net.Util;
using log4net.Core;
 
namespace log4net.Repository.Hierarchy
{
    /// <summary>
    /// Implementation of <see cref="ILogger"/> used by <see cref="Hierarchy"/>
    /// </summary>
    /// <remarks>
    /// <para>
    /// Internal class used to provide implementation of <see cref="ILogger"/>
    /// interface. Applications should use <see cref="LogManager"/> to get
    /// logger instances.
    /// </para>
    /// <para>
    /// This is one of the central classes in the log4net implementation. One of the
    /// distinctive features of log4net are hierarchical loggers and their
    /// evaluation. The <see cref="Hierarchy"/> organizes the <see cref="Logger"/>
    /// instances into a rooted tree hierarchy.
    /// </para>
    /// <para>
    /// The <see cref="Logger"/> class is abstract. Only concrete subclasses of
    /// <see cref="Logger"/> can be created. The <see cref="ILoggerFactory"/>
    /// is used to create instances of this type for the <see cref="Hierarchy"/>.
    /// </para>
    /// </remarks>
    /// <author>Nicko Cadell</author>
    /// <author>Gert Driesen</author>
    /// <author>Aspi Havewala</author>
    /// <author>Douglas de la Torre</author>
    public abstract class Logger : IAppenderAttachable, ILogger
    {
        #region Protected Instance Constructors
 
        /// <summary>
        /// This constructor created a new <see cref="Logger" /> instance and
        /// sets its name.
        /// </summary>
        /// <param name="name">The name of the <see cref="Logger" />.</param>
        /// <remarks>
        /// <para>
        /// This constructor is protected and designed to be used by
        /// a subclass that is not abstract.
        /// </para>
        /// <para>
        /// Loggers are constructed by <see cref="ILoggerFactory"/> 
        /// objects. See <see cref="DefaultLoggerFactory"/> for the default
        /// logger creator.
        /// </para>
        /// </remarks>
        protected Logger(string name) 
        {
#if NETCF
            // NETCF: String.Intern causes Native Exception
            m_name = name;
#else
            m_name = string.Intern(name);
#endif
        }
 
        #endregion Protected Instance Constructors
 
        #region Public Instance Properties
 
        /// <summary>
        /// Gets or sets the parent logger in the hierarchy.
        /// </summary>
        /// <value>
        /// The parent logger in the hierarchy.
        /// </value>
        /// <remarks>
        /// <para>
        /// Part of the Composite pattern that makes the hierarchy.
        /// The hierarchy is parent linked rather than child linked.
        /// </para>
        /// </remarks>
        virtual public Logger Parent
        {
            get { return m_parent; }
            set { m_parent = value; }
        }
 
        /// <summary>
        /// Gets or sets a value indicating if child loggers inherit their parent's appenders.
        /// </summary>
        /// <value>
        /// <c>true</c> if child loggers inherit their parent's appenders.
        /// </value>
        /// <remarks>
        /// <para>
        /// Additivity is set to <c>true</c> by default, that is children inherit
        /// the appenders of their ancestors by default. If this variable is
        /// set to <c>false</c> then the appenders found in the
        /// ancestors of this logger are not used. However, the children
        /// of this logger will inherit its appenders, unless the children
        /// have their additivity flag set to <c>false</c> too. See
        /// the user manual for more details.
        /// </para>
        /// </remarks>
        virtual public bool Additivity
        {
            get { return m_additive; }
            set { m_additive = value; }
        }
 
        /// <summary>
        /// Gets the effective level for this logger.
        /// </summary>
        /// <returns>The nearest level in the logger hierarchy.</returns>
        /// <remarks>
        /// <para>
        /// Starting from this logger, searches the logger hierarchy for a
        /// non-null level and returns it. Otherwise, returns the level of the
        /// root logger.
        /// </para>
        /// <para>The Logger class is designed so that this method executes as
        /// quickly as possible.</para>
        /// </remarks>
        virtual public Level EffectiveLevel
        {
            get 
            {
                for(Logger c = this; c != null; c = c.m_parent) 
                {
                    Level level = c.m_level;
 
                    // Casting level to Object for performance, otherwise the overloaded operator is called
                    if ((object)level != null) 
                    {
                        return level;
                    }
                }
                return null; // If reached will cause an NullPointerException.
            }
        }
 
        /// <summary>
        /// Gets or sets the <see cref="Hierarchy"/> where this 
        /// <c>Logger</c> instance is attached to.
        /// </summary>
        /// <value>The hierarchy that this logger belongs to.</value>
        /// <remarks>
        /// <para>
        /// This logger must be attached to a single <see cref="Hierarchy"/>.
        /// </para>
        /// </remarks>
        virtual public Hierarchy Hierarchy
        {
            get { return m_hierarchy; }
            set { m_hierarchy = value; }
        }
 
        /// <summary>
        /// Gets or sets the assigned <see cref="Level"/>, if any, for this Logger.  
        /// </summary>
        /// <value>
        /// The <see cref="Level"/> of this logger.
        /// </value>
        /// <remarks>
        /// <para>
        /// The assigned <see cref="Level"/> can be <c>null</c>.
        /// </para>
        /// </remarks>
        virtual public Level Level
        {
            get { return m_level; }
            set { m_level = value; }
        }
 
        #endregion Public Instance Properties
 
        #region Implementation of IAppenderAttachable
 
        /// <summary>
        /// Add <paramref name="newAppender"/> to the list of appenders of this
        /// Logger instance.
        /// </summary>
        /// <param name="newAppender">An appender to add to this logger</param>
        /// <remarks>
        /// <para>
        /// Add <paramref name="newAppender"/> to the list of appenders of this
        /// Logger instance.
        /// </para>
        /// <para>
        /// If <paramref name="newAppender"/> is already in the list of
        /// appenders, then it won't be added again.
        /// </para>
        /// </remarks>
        virtual public void AddAppender(IAppender newAppender) 
        {
            if (newAppender == null)
            {
                throw new ArgumentNullException("newAppender");
            }
 
            m_appenderLock.AcquireWriterLock();
            try
            {
                if (m_appenderAttachedImpl == null) 
                {
                    m_appenderAttachedImpl = new log4net.Util.AppenderAttachedImpl();
                }
                m_appenderAttachedImpl.AddAppender(newAppender);
            }
            finally
            {
                m_appenderLock.ReleaseWriterLock();
            }
        }
 
        /// <summary>
        /// Get the appenders contained in this logger as an 
        /// <see cref="System.Collections.ICollection"/>.
        /// </summary>
        /// <returns>A collection of the appenders in this logger</returns>
        /// <remarks>
        /// <para>
        /// Get the appenders contained in this logger as an 
        /// <see cref="System.Collections.ICollection"/>. If no appenders 
        /// can be found, then a <see cref="EmptyCollection"/> is returned.
        /// </para>
        /// </remarks>
        virtual public AppenderCollection Appenders 
        {
            get
            {
                m_appenderLock.AcquireReaderLock();
                try
                {
                    if (m_appenderAttachedImpl == null)
                    {
                        return AppenderCollection.EmptyCollection;
                    }
                    else 
                    {
                        return m_appenderAttachedImpl.Appenders;
                    }
                }
                finally
                {
                    m_appenderLock.ReleaseReaderLock();
                }
            }
        }
 
        /// <summary>
        /// Look for the appender named as <c>name</c>
        /// </summary>
        /// <param name="name">The name of the appender to lookup</param>
        /// <returns>The appender with the name specified, or <c>null</c>.</returns>
        /// <remarks>
        /// <para>
        /// Returns the named appender, or null if the appender is not found.
        /// </para>
        /// </remarks>
        virtual public IAppender GetAppender(string name) 
        {
            m_appenderLock.AcquireReaderLock();
            try
            {
                if (m_appenderAttachedImpl == null || name == null)
                {
                    return null;
                }
 
                return m_appenderAttachedImpl.GetAppender(name);
            }
            finally
            {
                m_appenderLock.ReleaseReaderLock();
            }
        }
 
        /// <summary>
        /// Remove all previously added appenders from this Logger instance.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Remove all previously added appenders from this Logger instance.
        /// </para>
        /// <para>
        /// This is useful when re-reading configuration information.
        /// </para>
        /// </remarks>
        virtual public void RemoveAllAppenders() 
        {
            m_appenderLock.AcquireWriterLock();
            try
            {
                if (m_appenderAttachedImpl != null) 
                {
                    m_appenderAttachedImpl.RemoveAllAppenders();
                    m_appenderAttachedImpl = null;
                }
            }
            finally
            {
                m_appenderLock.ReleaseWriterLock();
            }
        }
 
        /// <summary>
        /// Remove the appender passed as parameter form the list of appenders.
        /// </summary>
        /// <param name="appender">The appender to remove</param>
        /// <returns>The appender removed from the list</returns>
        /// <remarks>
        /// <para>
        /// Remove the appender passed as parameter form the list of appenders.
        /// The appender removed is not closed.
        /// If you are discarding the appender you must call
        /// <see cref="IAppender.Close"/> on the appender removed.
        /// </para>
        /// </remarks>
        virtual public IAppender RemoveAppender(IAppender appender) 
        {
            m_appenderLock.AcquireWriterLock();
            try
            {
                if (appender != null && m_appenderAttachedImpl != null) 
                {
                    return m_appenderAttachedImpl.RemoveAppender(appender);
                }
            }
            finally
            {
                m_appenderLock.ReleaseWriterLock();
            }
            return null;
        }
 
        /// <summary>
        /// Remove the appender passed as parameter form the list of appenders.
        /// </summary>
        /// <param name="name">The name of the appender to remove</param>
        /// <returns>The appender removed from the list</returns>
        /// <remarks>
        /// <para>
        /// Remove the named appender passed as parameter form the list of appenders.
        /// The appender removed is not closed.
        /// If you are discarding the appender you must call
        /// <see cref="IAppender.Close"/> on the appender removed.
        /// </para>
        /// </remarks>
        virtual public IAppender RemoveAppender(string name) 
        {
            m_appenderLock.AcquireWriterLock();
            try
            {
                if (name != null && m_appenderAttachedImpl != null)
                {
                    return m_appenderAttachedImpl.RemoveAppender(name);
                }
            }
            finally
            {
                m_appenderLock.ReleaseWriterLock();
            }
            return null;
        }
  
        #endregion
 
        #region Implementation of ILogger
 
        /// <summary>
        /// Gets the logger name.
        /// </summary>
        /// <value>
        /// The name of the logger.
        /// </value>
        /// <remarks>
        /// <para>
        /// The name of this logger
        /// </para>
        /// </remarks>
        virtual public string Name
        {
            get { return m_name; }
        }
 
        /// <summary>
        /// This generic form is intended to be used by wrappers.
        /// </summary>
        /// <param name="callerStackBoundaryDeclaringType">The declaring type of the method that is
        /// the stack boundary into the logging system for this call.</param>
        /// <param name="level">The level of the message to be logged.</param>
        /// <param name="message">The message object to log.</param>
        /// <param name="exception">The exception to log, including its stack trace.</param>
        /// <remarks>
        /// <para>
        /// Generate a logging event for the specified <paramref name="level"/> using
        /// the <paramref name="message"/> and <paramref name="exception"/>.
        /// </para>
        /// <para>
        /// This method must not throw any exception to the caller.
        /// </para>
        /// </remarks>
        virtual public void Log(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception) 
        {
            try
            {
                if (IsEnabledFor(level))
                {
                    ForcedLog((callerStackBoundaryDeclaringType != null) ? callerStackBoundaryDeclaringType : declaringType, level, message, exception);
                }
            }
            catch (Exception ex)
            {
                log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
            }
#if !NET_2_0 && !MONO_2_0
            catch
            {
                log4net.Util.LogLog.Error(declaringType, "Exception while logging");
            }
#endif
        }
 
        /// <summary>
        /// This is the most generic printing method that is intended to be used 
        /// by wrappers.
        /// </summary>
        /// <param name="logEvent">The event being logged.</param>
        /// <remarks>
        /// <para>
        /// Logs the specified logging event through this logger.
        /// </para>
        /// <para>
        /// This method must not throw any exception to the caller.
        /// </para>
        /// </remarks>
        virtual public void Log(LoggingEvent logEvent)
        {
            try
            {
                if (logEvent != null)
                {
                    if (IsEnabledFor(logEvent.Level))
                    {
                        ForcedLog(logEvent);
                    }
                }
            }
            catch (Exception ex)
            {
                log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
            }
#if !NET_2_0 && !MONO_2_0
            catch
            {
                log4net.Util.LogLog.Error(declaringType, "Exception while logging");
            }
#endif
        }
 
        /// <summary>
        /// Checks if this logger is enabled for a given <see cref="Level"/> passed as parameter.
        /// </summary>
        /// <param name="level">The level to check.</param>
        /// <returns>
        /// <c>true</c> if this logger is enabled for <c>level</c>, otherwise <c>false</c>.
        /// </returns>
        /// <remarks>
        /// <para>
        /// Test if this logger is going to log events of the specified <paramref name="level"/>.
        /// </para>
        /// <para>
        /// This method must not throw any exception to the caller.
        /// </para>
        /// </remarks>
        virtual public bool IsEnabledFor(Level level)
        {
            try
            {
                if (level != null)
                {
                    if (m_hierarchy.IsDisabled(level))
                    {
                        return false;
                    }
                    return level >= this.EffectiveLevel;
                }
            }
            catch (Exception ex)
            {
                log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
            }
#if !NET_2_0 && !MONO_2_0
            catch
            {
                log4net.Util.LogLog.Error(declaringType, "Exception while logging");
            }
#endif
            return false;
        }
 
        /// <summary>
        /// Gets the <see cref="ILoggerRepository"/> where this 
        /// <c>Logger</c> instance is attached to.
        /// </summary>
        /// <value>
        /// The <see cref="ILoggerRepository" /> that this logger belongs to.
        /// </value>
        /// <remarks>
        /// <para>
        /// Gets the <see cref="ILoggerRepository"/> where this 
        /// <c>Logger</c> instance is attached to.
        /// </para>
        /// </remarks>
        public ILoggerRepository Repository
        { 
            get { return m_hierarchy; }
        }
 
          #endregion Implementation of ILogger
 
        /// <summary>
        /// Deliver the <see cref="LoggingEvent"/> to the attached appenders.
        /// </summary>
        /// <param name="loggingEvent">The event to log.</param>
        /// <remarks>
        /// <para>
        /// Call the appenders in the hierarchy starting at
        /// <c>this</c>. If no appenders could be found, emit a
        /// warning.
        /// </para>
        /// <para>
        /// This method calls all the appenders inherited from the
        /// hierarchy circumventing any evaluation of whether to log or not
        /// to log the particular log request.
        /// </para>
        /// </remarks>
        virtual protected void CallAppenders(LoggingEvent loggingEvent) 
        {
            if (loggingEvent == null)
            {
                throw new ArgumentNullException("loggingEvent");
            }
 
            int writes = 0;
 
            for(Logger c=this; c != null; c=c.m_parent) 
            {
                if (c.m_appenderAttachedImpl != null) 
                {
                    // Protected against simultaneous call to addAppender, removeAppender,...
                    c.m_appenderLock.AcquireReaderLock();
                    try
                    {
                        if (c.m_appenderAttachedImpl != null) 
                        {
                            writes += c.m_appenderAttachedImpl.AppendLoopOnAppenders(loggingEvent);
                        }
                    }
                    finally
                    {
                        c.m_appenderLock.ReleaseReaderLock();
                    }
                }
 
                if (!c.m_additive) 
                {
                    break;
                }
            }
            
            // No appenders in hierarchy, warn user only once.
            //
            // Note that by including the AppDomain values for the currently running
            // thread, it becomes much easier to see which application the warning
            // is from, which is especially helpful in a multi-AppDomain environment
            // (like IIS with multiple VDIRS).  Without this, it can be difficult
            // or impossible to determine which .config file is missing appender
            // definitions.
            //
            if (!m_hierarchy.EmittedNoAppenderWarning && writes == 0) 
            {
                LogLog.Debug(declaringType, "No appenders could be found for logger [" + Name + "] repository [" + Repository.Name + "]");
                LogLog.Debug(declaringType, "Please initialize the log4net system properly.");
                try
                {
                    LogLog.Debug(declaringType, "    Current AppDomain context information: ");
                    LogLog.Debug(declaringType, "       BaseDirectory   : " + SystemInfo.ApplicationBaseDirectory);
#if !NETCF
                    LogLog.Debug(declaringType, "       FriendlyName    : " + AppDomain.CurrentDomain.FriendlyName);
                    LogLog.Debug(declaringType, "       DynamicDirectory: " + AppDomain.CurrentDomain.DynamicDirectory);
#endif
                }
                catch(System.Security.SecurityException)
                {
                    // Insufficient permissions to display info from the AppDomain
                }
                m_hierarchy.EmittedNoAppenderWarning = true;
            }
        }
 
        /// <summary>
        /// Closes all attached appenders implementing the <see cref="IAppenderAttachable"/> interface.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Used to ensure that the appenders are correctly shutdown.
        /// </para>
        /// </remarks>
        virtual public void CloseNestedAppenders() 
        {
            m_appenderLock.AcquireWriterLock();
            try
            {
                if (m_appenderAttachedImpl != null)
                {
                    AppenderCollection appenders = m_appenderAttachedImpl.Appenders;
                    foreach(IAppender appender in appenders)
                    {
                        if (appender is IAppenderAttachable)
                        {
                            appender.Close();
                        }
                    }
                }
            }
            finally
            {
                m_appenderLock.ReleaseWriterLock();
            }
        }
 
        /// <summary>
        /// This is the most generic printing method. This generic form is intended to be used by wrappers
        /// </summary>
        /// <param name="level">The level of the message to be logged.</param>
        /// <param name="message">The message object to log.</param>
        /// <param name="exception">The exception to log, including its stack trace.</param>
        /// <remarks>
        /// <para>
        /// Generate a logging event for the specified <paramref name="level"/> using
        /// the <paramref name="message"/>.
        /// </para>
        /// </remarks>
        virtual public void Log(Level level, object message, Exception exception) 
        {
            if (IsEnabledFor(level))
            {
                ForcedLog(declaringType, level, message, exception);
            }
        }
 
        /// <summary>
        /// Creates a new logging event and logs the event without further checks.
        /// </summary>
        /// <param name="callerStackBoundaryDeclaringType">The declaring type of the method that is
        /// the stack boundary into the logging system for this call.</param>
        /// <param name="level">The level of the message to be logged.</param>
        /// <param name="message">The message object to log.</param>
        /// <param name="exception">The exception to log, including its stack trace.</param>
        /// <remarks>
        /// <para>
        /// Generates a logging event and delivers it to the attached
        /// appenders.
        /// </para>
        /// </remarks>
        virtual protected void ForcedLog(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception) 
        {
            CallAppenders(new LoggingEvent(callerStackBoundaryDeclaringType, this.Hierarchy, this.Name, level, message, exception));
        }
 
        /// <summary>
        /// Creates a new logging event and logs the event without further checks.
        /// </summary>
        /// <param name="logEvent">The event being logged.</param>
        /// <remarks>
        /// <para>
        /// Delivers the logging event to the attached appenders.
        /// </para>
        /// </remarks>
        virtual protected void ForcedLog(LoggingEvent logEvent) 
        {
            // The logging event may not have been created by this logger
            // the Repository may not be correctly set on the event. This
            // is required for the appenders to correctly lookup renderers etc...
            logEvent.EnsureRepository(this.Hierarchy);
 
            CallAppenders(logEvent);
        }
 
        #region Private Static Fields
 
        /// <summary>
        /// The fully qualified type of the Logger class.
        /// </summary>
        private readonly static Type declaringType = typeof(Logger);
 
        #endregion Private Static Fields
 
        #region Private Instance Fields
 
        /// <summary>
        /// The name of this logger.
        /// </summary>
        private readonly string m_name;  
 
        /// <summary>
        /// The assigned level of this logger. 
        /// </summary>
        /// <remarks>
        /// <para>
        /// The <c>level</c> variable need not be 
        /// assigned a value in which case it is inherited 
        /// form the hierarchy.
        /// </para>
        /// </remarks>
        private Level m_level;
 
        /// <summary>
        /// The parent of this logger.
        /// </summary>
        /// <remarks>
        /// <para>
        /// The parent of this logger. 
        /// All loggers have at least one ancestor which is the root logger.
        /// </para>
        /// </remarks>
        private Logger m_parent;
 
        /// <summary>
        /// Loggers need to know what Hierarchy they are in.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Loggers need to know what Hierarchy they are in.
        /// The hierarchy that this logger is a member of is stored
        /// here.
        /// </para>
        /// </remarks>
        private Hierarchy m_hierarchy;
 
        /// <summary>
        /// Helper implementation of the <see cref="IAppenderAttachable"/> interface
        /// </summary>
        private log4net.Util.AppenderAttachedImpl m_appenderAttachedImpl;
 
        /// <summary>
        /// Flag indicating if child loggers inherit their parents appenders
        /// </summary>
        /// <remarks>
        /// <para>
        /// Additivity is set to true by default, that is children inherit
        /// the appenders of their ancestors by default. If this variable is
        /// set to <c>false</c> then the appenders found in the
        /// ancestors of this logger are not used. However, the children
        /// of this logger will inherit its appenders, unless the children
        /// have their additivity flag set to <c>false</c> too. See
        /// the user manual for more details.
        /// </para>
        /// </remarks>
        private bool m_additive = true;
 
        /// <summary>
        /// Lock to protect AppenderAttachedImpl variable m_appenderAttachedImpl
        /// </summary>
        private readonly ReaderWriterLock m_appenderLock = new ReaderWriterLock();
  
        #endregion
    }
}