Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The default configuration for logging uses Log4J as the logging toolkit, though this can be changed.

Class to Logger

The logger name for a page or component matches the fully qualified class name. You can configure this in log4j.properties:

...

You may mark a field of type Logger with the @Inject annotation. The proper Logger for your page or component will be injected.

No Formatcode
public class MyPage
{
  @Inject
  private Logger logger;
  
  . . .

...

You may mark any component method with the @Log annotation. Method entry, exit (and any thrown exceptions) will be logged at DEBUG level, along with parameter values and the method's return value. This is very convienient convenient for debugging, especially when placed on event handler methods.

...

No Format
[DEBUG] ActionLink Dispatch event: ComponentEvent[action from (self)]
[DEBUG] ActionDemo Dispatch event: ComponentEvent[action from actionlink]
[DEBUG] ActionDemo Invoking: org.apache.tapestry5.integration.app1.pages.nested.ActionDemo.onAction(java.lang.Long) (at ActionDemo.java:28)
[DEBUG] ActionDemo Dispatch event: ComponentEvent[passivate from (self)]
[DEBUG] ActionDemo Invoking: org.apache.tapestry5.integration.app1.pages.nested.ActionDemo.onPassivate() (at ActionDemo.java:38)

Render

...

Queue Debugging

Occasionally it is useful to get debugging output of all the steps involved in rendering a page. In Tapestry, rendering involves a series of rendering commands passed through a rendering queue (most commands will operate by queuing up additional commands). A rendering command may represent an element or attribute from a component template, or some template text, or it may represent one render phase when rendering a component.

The logger is the page's logger prefixed with "tapestry.render.".

...