This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
There are 3 popular log/trace facilities commonly used in Java: log4j, apache commons logging, and the JDK logger. Log4j and apache logging can intercept JDK logging (and, it think each other) so a mixed logging system is not only possible, but often done. For example, I think Tomcat's presently using log4j, but deployed webapps don't have to.
You do not normally enable tracing - or any of the other logging levels for that matter internal to the application. At best, it's extra logic. At worst, something blows up in the middle of the night and you have to recompile the app to see what's wrong. So instead you use the logging config files.
The major Java loggers all allow you to fine-tune logging at the package level. This means not only that you can keep yourself from being buried alive in stuff from uninteresting parts of your own app, but that if you need to trace org.apache.commons.digester stuff, you won't automatically have to endure noise from org.apache.commons.collections.
So the simplest way to trace is :
The logging methods were designed for minimal overhead. You only need to check loglevels if you intend to format your log message using expensive operations that won't be used if the log isn't written. Use it only to bypass the expensive logic and never put application logic in a loglevel test! Otherwise everytime you change the logging environment, the program will go bonkers.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jun 07, 2006
Thanks but my problem at the moment is that when I click on a commandLink, no action is done (but I'm correctly redirected to the same page as configured in faces-config.xml).
I have identified that this is happening when I put a SelectOneMenu object (because it works when I remove it).
Problem is that I don't have any idea where is this going wrong ... So I wanted to log what's going on in the servlet. And I saw that in FacesServlet spec they use the isTraceEnabled method. That's what I wanted to put logging on only on jsf core methods and not on mine.
Christophe i think, i know exactly where you are going wrong. just 1 week ago i was in your position and took 1 week to find after googling and lots of posting on the forums. so here it is
in JSF, for input text fields, other than strings we need to do conversion, like for example, if your are using Date field, then you need to do conversion . Check out Date field conversion for JSF in google. If you don't do conversion JSF doesn't complain and there will be no errors in the log. But you actions doesn't work like h:commandButton. Nope, they don't work
I don't know what all fields you are using in your JSF, you can put a simple text field of String type and test it, it works.
if you want log, then you need to put validation errors for the fields. Even if you really don't want to validate the fields
let me know if it works. Feels great to solve it ( if i did )