0

I've a problem when I've to show a bean property in a struts tag. I've log4j to debug mode, and when I use OGNL expression to evaluate a bean, I get the correct value in the screen, but I also get a lot of warnings in console. Here's the code:

<s:textfield id="citta" name="citta" value="%{add.citta}" />

or another example:

<s:if test="%{add.citta != null}" > ... </s:if>

The value add.citta is shown, but in console I get:

DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering getProperty (ognl.OgnlContext@b07b029a,org.apache.struts2.util.AttributeMap@ac995a,templateDir)
 - [2012-11-30 10:52:43,150]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering nullPropertyValue [target=[it.consoft.controller.GestioneAddress@4d92da, com.opensymphony.xwork2.DefaultTextProvider@b39ad9], property=templateDir]
 - [2012-11-30 10:52:43,153]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering nullPropertyValue [target=[it.consoft.controller.GestioneAddress@4d92da, com.opensymphony.xwork2.DefaultTextProvider@b39ad9], property=templateDir]
 - [2012-11-30 10:52:43,155]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering nullPropertyValue [target=org.apache.struts2.util.AttributeMap@ac995a, property=templateDir]
 - [2012-11-30 10:52:43,157]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Property: null
 - [2012-11-30 10:52:43,159]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Class: com.opensymphony.xwork2.util.CompoundRoot
 - [2012-11-30 10:52:43,160]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - field-level type converter for property [null] = none found
 - [2012-11-30 10:52:43,162]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - global-level type converter for property [null] = none found
 - [2012-11-30 10:52:43,163]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - falling back to default type converter [com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@b5c55e]
 - [2012-11-30 10:52:43,165]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering getProperty (ognl.OgnlContext@b07b029a,org.apache.struts2.util.AttributeMap@ac995a,theme)
 - [2012-11-30 10:52:43,167]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering nullPropertyValue [target=[it.consoft.controller.GestioneAddress@4d92da, com.opensymphony.xwork2.DefaultTextProvider@b39ad9], property=theme]
 - [2012-11-30 10:52:43,169]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering nullPropertyValue [target=[it.consoft.controller.GestioneAddress@4d92da, com.opensymphony.xwork2.DefaultTextProvider@b39ad9], property=theme]
 - [2012-11-30 10:52:43,171]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering nullPropertyValue [target=org.apache.struts2.util.AttributeMap@ac995a, property=theme]
 - [2012-11-30 10:52:43,173]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Property: null
 - [2012-11-30 10:52:43,175]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Class: com.opensymphony.xwork2.util.CompoundRoot
 - [2012-11-30 10:52:43,176]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - field-level type converter for property [null] = none found
 - [2012-11-30 10:52:43,176]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - global-level type converter for property [null] = none found
 - [2012-11-30 10:52:43,177]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - falling back to default type converter [com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@b5c55e]
 - [2012-11-30 10:52:43,178]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering nullPropertyValue [target=[it.consoft.controller.GestioneAddress@4d92da, com.opensymphony.xwork2.DefaultTextProvider@b39ad9], property=registrazione]
 - [2012-11-30 10:52:43,180]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering getProperty (ognl.OgnlContext@b07b029a,org.apache.struts2.util.AttributeMap@ac995a,citta)
 - [2012-11-30 10:52:43,184]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering getProperty (ognl.OgnlContext@b07b029a,org.apache.struts2.util.AttributeMap@ac995a,templateDir)
 - [2012-11-30 10:52:43,185]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering nullPropertyValue [target=[it.consoft.controller.GestioneAddress@4d92da, com.opensymphony.xwork2.DefaultTextProvider@b39ad9], property=templateDir]
 - [2012-11-30 10:52:43,186]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering nullPropertyValue [target=[it.consoft.controller.GestioneAddress@4d92da, com.opensymphony.xwork2.DefaultTextProvider@b39ad9], property=templateDir]
 - [2012-11-30 10:52:43,187]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Entering nullPropertyValue [target=org.apache.struts2.util.AttributeMap@ac995a, property=templateDir]
 - [2012-11-30 10:52:43,188]DEBUG [http-bio-8080-exec-2] (CommonsLogger.java:68) - Property: null

I would like to fix it, I've tried also to declare a variable with <s:set> or <s:bean> but warnings didn't disappear.

Here's my class:

public class GestioneAddress extends ActionSupport {

    private Address add;

public Address getAdd() {
        return add;
    }


    public void setAdd(Address add) {
        this.add = add;
        }
}

Here's my bean:

public class Address implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "AddressID")

    private Integer addressID;

    @Basic(optional = false)
    @Size(min = 1, max = 45)
    @Column(name = "Citta")

    private String citta;



    public Integer getAddressID() {
        return addressID;
    }

    public void setAddressID(Integer addressID) {
        this.addressID = addressID;
    }

    public String getCitta() {
        return citta;
    }

    public void setCitta(String citta) {
        this.citta = citta;
    }

}
Gore
  • 199
  • 1
  • 2
  • 12
  • ok, but there are too much debug LINES (83! I only wrote some of them) for that evaluation, and I think there's something wrong with that. They slow down my application. – Gore Nov 30 '12 at 10:59
  • There is nothing wrong, just level up your log level – Jaiwo99 Nov 30 '12 at 11:19
  • @Gore:Change log level, but still i believe for development more the log info you have more easy to do debugging – Umesh Awasthi Nov 30 '12 at 11:20
  • yeah, I think the same, but those lines are so redundant, I would like to exclude them from debug log. Thanks for your replies, folks. – Gore Nov 30 '12 at 11:43
  • You can include/exclude logging on a package by package basis. I wouldn't been too worried about slowing down your application, debug level logging shouldn't be enabled for a production application (or during performance testing) same goes for struts2 debug mode. During development you are the only one using the application generally on a pretty powerful machine... it isn't an issue. – Quaternion Nov 30 '12 at 13:20
  • http://stackoverflow.com/questions/5498685/log4j-logging-a-package-but-excluding-its-sub-packages – Quaternion Nov 30 '12 at 13:23
  • I don't understand the issue here. You're at DEBUG log level, you'll get whatever DEBUG messages the library/libraries emit. You want a different level, or different levels for different packages/classes, change the level for those packages/classes. – Dave Newton Nov 30 '12 at 15:35

0 Answers0