Exception on Convert for return %class{1} name
----------------------------------------------

                 Key: LOG4NET-215
                 URL: https://issues.apache.org/jira/browse/LOG4NET-215
             Project: Log4net
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.2.10
         Environment: Windows XP, Visual Studio 2008, .NET 2.0
            Reporter: Georgievsky Ilya


in function^

override protected void Convert(TextWriter writer, LoggingEvent loggingEvent)
                {
                        string name = GetFullyQualifiedName(loggingEvent);
                        if (m_precision <= 0)
                        {
                                writer.Write(name);
                        }
                        else 
                        {
                                int len = name.Length;

                                // We subtract 1 from 'len' when assigning to 
'end' to avoid out of
                                // bounds exception in return 
name.Substring(end+1, len). This can happen if
                                // precision is 1 and the logger name ends with 
a dot. 
                                int end = len - 1;
                                for(int i=m_precision; i>0; i--) 
                                {
                    end = name.LastIndexOf('.', end - 1);
                                        if (end == -1)
                                        {
                                                writer.Write(name);
                                                return;
                                        }
                                }
                                writer.Write(name.Substring(end+1, len-end-1));
                        }         
                }

if "string name = GetFullyQualifiedName(loggingEvent); " return '?' (noname 
class-name) in line "end = name.LastIndexOf('.', end - 1);" exceptrion because 
end = 0...



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to