[ 
https://issues.apache.org/jira/browse/LOG4NET-460?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joseph Edwards updated LOG4NET-460:
-----------------------------------
    Description: 
log4net.Repository.Hierarchy.Logger declares Hierarchy property as virtual, 
however, when reading the value it uses the private field m_hierarchy, which is 
not the correct value (and probably null) if a derived class has overridden the 
Hierarchy property.
This leads to a NullReferenceException when invoking the IsEnabledFor method, 
which is used in the Log method.

Expected: overriding the Hierarchy property works
Actual: overriding the Hierarchy property leaves the private field m_hierarchy 
unset, which causes NullReferenceExceptions to be thrown

This issue also appears to apply for Level and m_level.  The EffectiveLevel 
property accesses the private m_level field instead of the virtual Level 
property, which may also lead to NullReferenceException.

  was:
log4net.Repository.Hierarchy.Logger declares Hierarchy property as virtual, 
however, when reading the value it uses the private field m_hierarchy, which is 
not the correct value (and probably null) if a derived class has overridden the 
Hierarchy property.
This leads to a NullReferenceException when invoking the IsEnabledFor method, 
which is used in the Log method.

Expected: overriding the Hierarchy property works
Actual: overriding the Hierarchy property leaves the private field m_hierarchy 
unset, which causes NullReferenceExceptions to be thrown


> log4net.Repository.Hierarchy.Logger ignores overridden Hierarchy
> ----------------------------------------------------------------
>
>                 Key: LOG4NET-460
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-460
>             Project: Log4net
>          Issue Type: Bug
>            Reporter: Joseph Edwards
>
> log4net.Repository.Hierarchy.Logger declares Hierarchy property as virtual, 
> however, when reading the value it uses the private field m_hierarchy, which 
> is not the correct value (and probably null) if a derived class has 
> overridden the Hierarchy property.
> This leads to a NullReferenceException when invoking the IsEnabledFor method, 
> which is used in the Log method.
> Expected: overriding the Hierarchy property works
> Actual: overriding the Hierarchy property leaves the private field 
> m_hierarchy unset, which causes NullReferenceExceptions to be thrown
> This issue also appears to apply for Level and m_level.  The EffectiveLevel 
> property accesses the private m_level field instead of the virtual Level 
> property, which may also lead to NullReferenceException.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to