Skip to main content

How do I log JSF messages in GlassFish?

2 replies [Last post]
cayhorstmann
Offline
Joined: 2003-06-13

It happened again...I wrote a JSF page that does absolutely nothing when I click on a button. I fussed with it for a few hours, and I still don't know why. With Tomcat, I was able to edit logging.properties and turn on com.sun.faces.level=FINEST.

I tried doing this with GlassFish. The admin interface lets me add that level as an "additional log module property". That had no effect.

I then set the level of "Web Container" to FINEST, and that yielded an unbelievable number of messages, none of which contained the chatter that JSF normally leaves behind when doing navigation (or not doing it, in my case).

How should I activate JSF logging?

Thanks,

Cay

PS. Here is the relevant section of domain.xml.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
km105526
Offline
Joined: 2005-04-04

Can you try the following in the application code?

Logger.createLogger("com.sun.faces");
Logger.createLogger("com.sun.faces.level");

Now, the property in domain.xml should take effect.

Please let us know.

cayhorstmann
Offline
Joined: 2003-06-13

java.util.logging.Logger has no createLogger method. I tried getLogger and that has no effect.

At any rate, it makes no sense that I should have to create the logger. The logger is created when the JSF code makes a log call.

I figured it out, though, by looking at the source code for JSF. The logger is now called

javax.enterprise.resource.webcontainer.jsf

and there are children with names
.renderkit
.taglib
.application
.context
.config
.lifecycle

The .lifecycle and .application children are the most useful ones. At level FINE, you can see which phases JSF goes through.

Cay