Log4j 2
  1. Log4j 2
  2. LOG4J2-264

SetLoggerTag missing setter for value attribute (or tld wrongly requires value attribute for setLogger tag)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta6
    • Fix Version/s: 2.0-beta7
    • Component/s: Taglib
    • Labels:
      None

      Description

      I have the taglib imported thus:

      <%@ taglib uri="http://logging.apache.org/log4j/tld/log" prefix="log" %>

      and then tried to use setLogger as follows:

      <log:setLogger value="com.example.jsp.errors" />

      but this results in the following:

      Exception caught in jsp
      org.apache.jasper.JasperException: /WEB-INF/pages/orderform/error.jsp(13,0) Unable to find setter method for attribute: value
      ... etc.

      Had a quick nose around and the value attribute is marked as required in the tld, but the SetLoggerTag class doesn't have a setValue(...) method...

      From what I saw, wondered if in fact the value attribute is meant to have gone away and one should be using the logger attribute which is there in the class, but has no mention in the tld.

        Activity

        Jon Archer created issue -
        Jon Archer made changes -
        Field Original Value New Value
        Description I have the taglib imported thus:

        {{<%@ taglib uri="http://logging.apache.org/log4j/tld/log" prefix="log" %>}}

        and then tried to use {{setLogger}} as follows:

        {{<log:setLogger value="com.example.jsp.errors" />}}

        but this results in the following:

        {{Exception caught in jsp
        org.apache.jasper.JasperException: /WEB-INF/pages/orderform/error.jsp(13,0) Unable to find setter method for attribute: value
        ... etc.}}

        Had a quick nose around and the {{value}} attribute is marked as required in the tld, but the {{SetLoggerTag}} class _doesn't_ have a {{setValue(...)}} method...

        From what I saw, wondered if in fact the {{value}} attribute is meant to have gone away and one should be using the {{logger}} which is their in the class, but has no mention in the tld.
        I have the taglib imported thus:

        {{<%@ taglib uri="http://logging.apache.org/log4j/tld/log" prefix="log" %>}}

        and then tried to use {{setLogger}} as follows:

        {{<log:setLogger value="com.example.jsp.errors" />}}

        but this results in the following:

        {{Exception caught in jsp}}
        {{org.apache.jasper.JasperException: /WEB-INF/pages/orderform/error.jsp(13,0) Unable to find setter method for attribute: value}}
        {{... etc.}}

        Had a quick nose around and the {{value}} attribute is marked as required in the tld, but the {{SetLoggerTag}} class _doesn't_ have a {{setValue(...)}} method...

        From what I saw, wondered if in fact the {{value}} attribute is meant to have gone away and one should be using the {{logger}} which is their in the class, but has no mention in the tld.
        Jon Archer made changes -
        Description I have the taglib imported thus:

        {{<%@ taglib uri="http://logging.apache.org/log4j/tld/log" prefix="log" %>}}

        and then tried to use {{setLogger}} as follows:

        {{<log:setLogger value="com.example.jsp.errors" />}}

        but this results in the following:

        {{Exception caught in jsp}}
        {{org.apache.jasper.JasperException: /WEB-INF/pages/orderform/error.jsp(13,0) Unable to find setter method for attribute: value}}
        {{... etc.}}

        Had a quick nose around and the {{value}} attribute is marked as required in the tld, but the {{SetLoggerTag}} class _doesn't_ have a {{setValue(...)}} method...

        From what I saw, wondered if in fact the {{value}} attribute is meant to have gone away and one should be using the {{logger}} which is their in the class, but has no mention in the tld.
        I have the taglib imported thus:

        {{<%@ taglib uri="http://logging.apache.org/log4j/tld/log" prefix="log" %>}}

        and then tried to use {{setLogger}} as follows:

        {{<log:setLogger value="com.example.jsp.errors" />}}

        but this results in the following:

        {{Exception caught in jsp}}
        {{org.apache.jasper.JasperException: /WEB-INF/pages/orderform/error.jsp(13,0) Unable to find setter method for attribute: value}}
        {{... etc.}}

        Had a quick nose around and the {{value}} attribute is marked as required in the tld, but the {{SetLoggerTag}} class _doesn't_ have a {{setValue(...)}} method...

        From what I saw, wondered if in fact the {{value}} attribute is meant to have gone away and one should be using the {{logger}} attribute which is there in the class, but has no mention in the tld.
        Nick Williams made changes -
        Assignee Nick Williams [ beamerblvd ]
        Nick Williams made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Nick Williams added a comment - - edited

        Indeed, the TLD is incorrect, and the logger attribute should be used instead, not the value attribute, which doesn't actually exist. I'll get this fixed shortly.

        Show
        Nick Williams added a comment - - edited Indeed, the TLD is incorrect, and the logger attribute should be used instead, not the value attribute, which doesn't actually exist. I'll get this fixed shortly.
        Hide
        Nick Williams added a comment -

        Note: The maven-taglib-plugin is supposed to flag issues like this. However, the generated report is all green checkboxes. It does not flag the fact that the attribute does not have a setter. I have filed http://jira.openmindlab.com/browse/MAVENTAGLIB-16 about this.

        Also, I have filed a featured request for the maven-taglib-plugin to be able to run it at compile time and fail the build if validation fails. http://jira.openmindlab.com/browse/MAVENTAGLIB-17

        Show
        Nick Williams added a comment - Note: The maven-taglib-plugin is supposed to flag issues like this. However, the generated report is all green checkboxes. It does not flag the fact that the attribute does not have a setter. I have filed http://jira.openmindlab.com/browse/MAVENTAGLIB-16 about this. Also, I have filed a featured request for the maven-taglib-plugin to be able to run it at compile time and fail the build if validation fails. http://jira.openmindlab.com/browse/MAVENTAGLIB-17
        Hide
        Nick Williams added a comment -

        Resolved with r1485032. Please verify and close.

        Show
        Nick Williams added a comment - Resolved with r1485032. Please verify and close.
        Nick Williams made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 2.0-beta7 [ 12324400 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Nick Williams
            Reporter:
            Jon Archer
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development