Opentaps 2 Logging Service

From Opentaps Wiki
Revision as of 01:03, 26 January 2012 by Sichen (talk | contribs) (Protected "Opentaps 2 Logging Service": Sysop page [edit=sysop:move=sysop])
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

opentaps 2 Logging Service

Logging in opentaps 2 is handled by log4j. The org.opentaps.core.log.Log has methods to log messages with OSGi standardized LogService service. There are 4 group of methods for 4 severity levels defined in LogService interface: debug, error, warning, info).

Log file can be found in <geronimoHome>/var/log/geronimo.log. Logging configurations are set in server-log4j.properties in the same directory. Currently by default the root logger is configured to INFO level and this mean all messages will appear in the log except those with DEBUG severity. For those of you familiar with opentaps v1, the "debug" level is comparable to Verbose from ofbiz.

To write to the log,

import org.opentaps.core.log.Log;

//...
        Log.logInfo("Note created with id [" + note.getId() + "]");

will show

2012-01-25 16:55:41,669 INFO  [core] Note created with id [31970A55CA89482BB6CF9F67F19B945B]