Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-400

Guard exception that can occur when converting a message to a string

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.7.25
    • log4j-over-slf4j
      • OS : any
      • JDK : 1.8 (or any)

    Description

      An exception may occur when converting a message to a string(log4j-over-slf4j/src/main/java/org/apache/log4j/Category.convertToString method).

      For example, someone implements message class's toString method incorrect.

      Reprodution steps are described as sample project.
      Download the project and run command in your console(or IDE) 'mvn clean test', then you can see the test case is failed.

       

      I think it is better to ignore the exception and let the Category(Logger) continue to run - for example, if the exception is occured , then slf4j prints the exception and continues to call appenders with null message object.

      As an idea to resolve this problem,
      I've modified the slf4j's Category.java code and pull-requested to your slf4j repo(https://github.com/qos-ch/slf4j/pull/175).

      Could you comment on this issue?

       

      Attachments

        Activity

          People

            slf4j-dev SLF4J developers list
            Ken Ken Kwon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: