Tuesday, September 11, 2012

Setting up custom loggers in Maximo

Using out of box loggers to debug Maximo customizations is not a good idea as developers end up leaving the debug on which will impact the overall system performance. On creation of a custom logger, we can only turn the debug on for the custom logger and leave the other loggers in their current state.

Here is a quick and easy way to create and use custom loggers for Maximo customizations.This logger can be used only for the custom Java code that developers write in Maximo.


1.Navigate to System Configuration -> Platform Configuration -> Logging
2.Click on New Row under Root Logger
3.Enter the following:   
           Logger: Customization
           Log Level: DEBUG
           Key: log4j.logger.maximo.Customization
           Inherited Appenders: Console,Rolling
           Enable Active checkbox.
4.Save the logging properties
5.Click on Select Action -> Apply Settings



Here is a sample of how to use the custom logger in a Custom class:

/** Import the following classes to use a custom logger */
import psdi.util.logging.MXLogger;
import psdi.util.logging.MXLoggerFactory;

public class ExPO extends PO implements PORemote
{

    /** Declare the logger as an instance of MXLogger */
    MXLogger myLogger;
   

    public ExPO (MboSet mboset) throws MXException, RemoteException
    {
            super(mboset);

            /**Get the instance of the custom logger using the key maximo.Customization which is            defined in Step 3 of the logger configuration */

            myLogger = MXLoggerFactory.getLogger("maximo.Customization");
            myLogger.debug("**Inside the constructor of custom.app.po.ExPO**");          
    }

}
    


No comments:

Post a Comment