Bug 52676 - Location information unavailable when FQCN ends in .
Summary: Location information unavailable when FQCN ends in .
Status: NEW
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Layout (show other bugs)
Version: 1.2
Hardware: Macintosh All
: P2 normal
Target Milestone: ---
Assignee: log4j-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-15 23:03 UTC by Allen Holub
Modified: 2012-02-15 23:04 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Allen Holub 2012-02-15 23:03:16 UTC
This is arguably a bug in the sample application.

When both extending and wrapping Logger, the sample application suggests that "It's usually a good idea to add a dot suffix to the fully qualified class name..."

However, if you do that, the location-related format conversions (%F, %L, etc) used by org.apache.log4j.PatternLayout do not work correctly. (They print question marks instead of the actual location info.)

The problem is the following line (org.apache.log4j.spi.LocationInfo, line 143):
      
    if(fqnOfCallingClass.equals(thisClass)) {
       //...

which checks for an exact match between the FQCN and the class name reported in the stack trace. The trailing dot prevents the match from succeeding, so the location information is not fetched. This code should be modified to accept a trailing dot as a valid match.