The built-in logger should be used over System.out
at all times. Examples of using the log function are included in the sample service operation added to each newly minted service class. If you use the default extension of JavaServiceSuperClass
, logging is already set up for you, and all you need to do is use log()
with a log level instead of System.out.println()
.
Good logging is critical to supporting and debugging any Java service. The JavaServiceSuperClass
class makes using the logging subsystem so easy there is no good reason to use System.out.println
; System.out
simply lacks the controls of log. Using the logger with levels allows you to control the verbosity of logging using /src/log4j.properties
instead of recompiling sources.
For example, in our updateCustomer()
example function, we use INFO
to log the name of the company being updated:
log(INFO, "Updating customer: " + customer.getCompany());
But, if there is an exception in performing the update, we use ERROR
to log the condition...