[
https://issues.apache.org/jira/browse/LOG4NET-580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16226839#comment-16226839
]
Timothy Fuller commented on LOG4NET-580:
----------------------------------------
Hi Dominik,
Thanks for the quick reply.
Just to give some context about how our company is using the logger.
In our application we have a hierarchy of user generated documents. These
documents are named by the users and the document names are then used for the
logger names when we are doing bulk data loads into the documents. These bulk
loads can have contain anything from 1 – 50000+ documents. As a result a lot of
logs are generated. We use the document’s name for the logger name to make it
easy for users to see which document generated the log message during the bulk
load process.
The exception we found has only occurred in our test environment, when a Qa
analyst entered a document name beginning with the character ’.’ It is unlikely
to occur in a production environment, but it can still happen.
I agree with you that this is an invalid name and adding a better exception
message would be an acceptable fix.
For our usage we ideally would want log4net to handle when the logger name has
invalid ‘.’ Characters. So in your example I believe ".Name": could be
interpreted as ["Name"], but I know not all consumers of log4net will use it in
the same way we do, so this may not be applicable to them.
We are currently looking at a fix to handle the invalid names and either
replace the invalid ‘.’ Characters with an underscore or remove the ‘.’
entirely before passing the logger name into
log4net.LogManager.GetLogger(String repository, String name). The slightly
altered logger name will still be very useful to our end users.
Thanks,
Timothy
> ArgumentOutOfRangeException - When logger name begins with character '.'
> ------------------------------------------------------------------------
>
> Key: LOG4NET-580
> URL: https://issues.apache.org/jira/browse/LOG4NET-580
> Project: Log4net
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.2.15, 2.0.6, 2.0.7, 2.0.8
> Reporter: Timothy Fuller
>
> When you try to get a logger and supply a name which begins with the '.'
> character for example ".Test" the code crashes in : at
> log4net.Repository.Hierarchy.Hierarchy.UpdateParents(Logger log)
> System.ArgumentOutOfRangeException: Index was out of range. Must be
> non-negative and less than the size of the collection.
> Parameter name: startIndex
> at System.String.LastIndexOf(Char value, Int32 startIndex, Int32 count)
> at log4net.Repository.Hierarchy.Hierarchy.UpdateParents(Logger log)
> at log4net.Repository.Hierarchy.Hierarchy.GetLogger(String name,
> ILoggerFactory factory)
> at log4net.Repository.Hierarchy.Hierarchy.GetLogger(String name)
> at log4net.Core.LoggerManager.GetLogger(String repository, String name)
> at log4net.LogManager.GetLogger(String repository, String name)
>
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)