Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleUse logger
collapsetrue
public void doSomething(CRMDOAccountingPeriod accountingPeriod) throws Exception {
	logger.debug("Invoked doSomething()");
	...
}

If the file does not extend CRMBase:

Code Block
titleUse logger
collapsetrue
public void doSomething(CRMDOAccountingPeriod accountingPeriod) throws Exception {
	Logger logger = LogUtil.getLogger(getCRMSession(), getClass());
	logger.debug("Invoked doSomething()");
	...
}

If the file is not related to an organisation:

Code Block
titleUse logger
collapsetrue
public void doSomething(CRMDOAccountingPeriod accountingPeriod) throws Exception {
	Logger logger = LogUtil.getLogger(getClass());
	logger.debug("Invoked doSomething()");
	...
}

If the method/file is asynchronous:

Code Block
titleUse logger
collapsetrue
@Asynchronous
public void execute(@Observes(during=TransactionPhase.AFTER_SUCCESS)  WorkflowRuleEvent event) {
	setLogger(event.getSession());
	logger.debug("Invoked execute()");
	...
}