เวลาเขียน Custom Class หากต้องการเขียน log ลงไป เพื่อทำการ Debug ให้ทำการ Configure ที่ Logging Application ดังนี้
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
จากนั้นใน Java Class ให้เขียน Function ขึ้นมาเพื่อเขียน log เช่น
private static void log(String msg)private static void log(String msg) {
MXLogger myLogger = MXLoggerFactory.getLogger(“maximo.Customization“);
if (myLogger.isDebugEnabled())
{
myLogger.debug(msg);
}
}
แล้วเวลาใช้ก็เรียน Function log เช่น
log(“Write Hello World”);
Read More