ADF, Logging

How to add custom logging into ADF application?

Can’t imagine development without logging. Even in ADF 🙂 For some quick output into local WebLogic console – System.out.println is quite ok. But if we need to have it in more professional and persistent way – java logging tools come to action. In ADF we have ADFLogger class at our service. Naturally it is extended java.util.logging.Logger indeed. So here is how to leverage it:

  • Define private or even better – protected attribute for the class you want to use logging service:
    protected ADFLogger logger = ADFLogger.createADFLogger(this.getClass());
  • Leverage appropriate methods of logger to push log messages of desired severity:
    logger.severe("Severe message logged!");
    logger.warning("Warning message logged!");
    

I’ve created a tiny demo application for this case. You can download it here. Just run index.jspx, click a button “Log Me” and look for log entries in integrated WebLogic console or enterprise manager log view page.

 

If experience troubles finding log records, please check my another post – Where to look for log records in WebLogic Enterprise Manager (EM)?

ADF Version 12.2.1.0.0

About Danas Tarnauskas