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

Allow to set FQCN in Log4jLoggerAdapter class


    • Type: Bug
    • Status: Closed
    • Resolution: Incomplete
    • Affects Version/s: 1.5.x
    • Fix Version/s: None
    • Component/s: Implementations
    • Labels:
    • Environment:

      Operating System: Windows NT
      Platform: PC


      I have the following scenario: Instead of using the Logger interface from SLF4J directly in the classes that do the logging, I wrote my own interface that is used. Because of that I have a class called LogAdapter which implements my interface and internally delegates logging calls to SLF4J.

      I use the slf4j-log4j12 jar file and have configured log4j to include the calling class name in the log output. After I changed my code to not use the SLF4J logger directly, but instead send log messages to the LogAdapter, which then sends the log messages to SLF4J, the class names written to the log files are not correct any more.

      I downloaded source files of SLF4J and log4j and found out that there is a field called FQCN in the Log4JLoggerAdapter class which is passed to log4j on logging calls. The FQCN is used by Log4J to determine the name of the class that caused a logging statement. The problem is that this field is final and hence I am not able to modify it even via reflection when using the setAccessible(true) method.

      Is there any way to make this class configurable from the outside? Maybe provide setter? If this is not feasible, removing the final modifier would at least allow to modify it via reflection...




            • Assignee:
              slf4j-dev SLF4J developers list
              bieringer.dominik@gmx.at Bieringer Dominik
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: