Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed bad links due to copy-paste from cwiki-test

 

Logging involves the automatic recording of progress as an application runs. Tapestry makes extensive use of SLF4J to log details about the creation and operation of your page and component classes.

...

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:

noformat
Code Block
titlelog4j.properties
log4j.category.org.apache.tapestry5.integration.app1.pages.MerryChristmas=trace

 

Injecting Loggers

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

Code Block
languagejava
titleMyPage.java
public class MyPage
{
    @Inject
    private Logger logger;

    . . .
  
    void onSuccessFromForm()
    {
        logger.info("Changes saved successfully");
    }

...