logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LOG4NET-56) Add override for WriteDictionary that accepts IDictionaryEnumerator
Date Sat, 12 Nov 2005 21:12:24 GMT
    [ http://issues.apache.org/jira/browse/LOG4NET-56?page=comments#action_12357505 ] 

Nicko Cadell commented on LOG4NET-56:
-------------------------------------


The PatternConverter is the base class for the converters used by the PatternLayout and the
PatternString. The WriteDictionary helper method in the base probably does not need extra
support for the IDictionaryEnumerator as it is only used to render IDictionary objects.

A call like:
log.Debug(hashTable);

will use the ObjectRenderer to convert the ICollection into a string. The code that does this
conversion is in log4net.ObjectRenderer.DefaultRenderer.

The reason why a call like:

log.Debug(hashTable.GetEnumerator());

does not produce the same output is that the log4net.ObjectRenderer.DefaultRenderer code does
not know how to render objects of type IEnumerator. 

The HttpRuntime.Cache object (of type System.Web.Caching.Cache) is a dictionary, but it does
not implement the IDictionary interface, nor does it implement ICollection. It does implement
the IEnumerable interface.

If you just change the log4net.ObjectRenderer.DefaultRenderer so that instead of checking
for ICollection it checks for IEnumerable then you can call:

log.Debug(HttpRuntime.Cache);


> Add override for WriteDictionary that accepts IDictionaryEnumerator
> -------------------------------------------------------------------
>
>          Key: LOG4NET-56
>          URL: http://issues.apache.org/jira/browse/LOG4NET-56
>      Project: Log4net
>         Type: Improvement
>     Reporter: Ron Grabowski
>     Priority: Minor
>  Attachments: WriteDictionaryUsingIDictionaryEnumerator.patch
>
> Some objects that use IDictionary objects expose an IDictionaryEnumerator instead of
the underlying IDictionary. HttpRuntime.Cache.GetEnumerator() is one such object.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message