I've made a few changes to how View creation and disposal logging works in 1.8. All of the related logging occurs under the log for the com.icesoft.faces.context.View class. This means that to turn it on, you just need to set the level for that class. For example, in the log4j.xml file that we ship with component-showcase, you can add the following entry:
<category name="com.icesoft.faces.context.View">
<priority value="debug"/>
</category>
Doing this will turn on logging that will record all View creation and disposal and track active views within a session that have not yet been disposed. If the logging level is not set to debug, no tracking is done. The new logging looks like this in the console:
Initial page load of http://localhost:8080/component-showcase/showcase.iface:
DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:1] for http:
After a reload:
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:1] - com.icesoft.faces.context.View
DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:2] for http:
If I intentionally add in a typical View leak problem (like a custom 404 error handler that uses ICEfaces), the initial page load will show:
DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:1] for http:DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:2] for http:DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:3] for http:DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:4] for http:DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:5] for http:DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:6] for http:
A reload will show:
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:1] - com.icesoft.faces.context.View
DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:7] for http:DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:8] for http:DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:9] for http:DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:10] for http:DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:11] for http:DEBUG - created View[Un-JuW8yLrXz5Oac_KFXdg:12] for http:
Note that there is only 1 View disposed so we have a leak. If I intentionally try to exceed the view limit (lowered to 10 for this example):
WARN - Concurrent view limit of 10 exceeded for session nKNtkZ6gGm2zTNZHRL6JMQ - com.icesoft.faces.webapp.http.core.MultiViewServer
INFO - views for session: nKNtkZ6gGm2zTNZHRL6JMQ
created : 13
disposed: 2
active : 11
{3=http:
Or I can let the session expire:
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:3] - com.icesoft.faces.context.View
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:2] - com.icesoft.faces.context.View
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:10] - com.icesoft.faces.context.View
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:7] - com.icesoft.faces.context.View
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:6] - com.icesoft.faces.context.View
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:5] - com.icesoft.faces.context.View
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:4] - com.icesoft.faces.context.View
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:9] - com.icesoft.faces.context.View
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:8] - com.icesoft.faces.context.View
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:11] - com.icesoft.faces.context.View
DEBUG - disposed View[Un-JuW8yLrXz5Oac_KFXdg:12] - com.icesoft.faces.context.View
INFO - views for session: Un-JuW8yLrXz5Oac_KFXdg
created : 12
disposed: 12
active : 0
{} - com.icesoft.faces.context.View
There are typically three causes for this message:
As an enhancement to the current debug mode for view disposal, it would make sense at session shutdown to log the number of views created and the number of views disposed in that session.