Log4net
  1. Log4net
  2. LOG4NET-215

Exception on Convert for return %class{1} name

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.10
    • Fix Version/s: 1.2.11
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Windows XP, Visual Studio 2008, .NET 2.0

      Description

      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...

        Activity

        Hide
        Stefan Bodewig added a comment -

        fixed with svn revision 1170104

        Show
        Stefan Bodewig added a comment - fixed with svn revision 1170104

          People

          • Assignee:
            Unassigned
            Reporter:
            Georgievsky Ilya
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development