[logback-dev] [JIRA] (LOGBACK-1319) framework packages are not excluded properly

QOS.CH (JIRA) noreply-jira at qos.ch
Sat Jun 24 15:04:00 CEST 2017


Bug Reporter created LOGBACK-1319:
-------------------------------------

             Summary: framework packages are not excluded properly
                 Key: LOGBACK-1319
                 URL: https://jira.qos.ch/browse/LOGBACK-1319
             Project: logback
          Issue Type: Bug
          Components: logback-classic
    Affects Versions: 1.2.3
            Reporter: Bug Reporter
            Assignee: Logback dev list


The [LoggerContext.getFrameworkPackages|https://logback.qos.ch/apidocs/ch/qos/logback/classic/LoggerContext.html#getFrameworkPackages()] documentation says this is a list of packages (including their subpackages) that get excluded when tracing the caller.
 But the implementation in [CallerData.isInFrameworkSpaceList|https://github.com/qos-ch/logback/blob/master/logback-classic/src/main/java/ch/qos/logback/classic/spi/CallerData.java#L104] is wrong because "com.foo" matches "com.foobar" which is not its subpackage.

I suggest changing
{code:java}
if (currentClass.startsWith(s)){code}
to
{code:java}
if (currentClass.startsWith(s + ".")){code}
or even
{code:java}
if (currentClass.equals(s) || currentClass.startsWith(s + ".")){code}
in case someone relies on this behavior to exclude specific classes (which would be nice anyway).

We could also add
{code:java}
if (s.equals("")) return !currentClass.contains("."){code}
to support excluding the default package classes.



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the logback-dev mailing list