Skip to end of banner
Go to start of banner

Logger configuration

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Logger writes information in log file.

What does this section cover?

Define logger

A logger is defined in the following path: project_name/src/main/resources/metadata/logbackloggers.xml:
-loggername and logbackappenderfilename must be unique
-logbackclassname must be defined only once

Define logger
<logbackconfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/applications.xsd">
       <logbackloggers> 
               <logbacklogger>
                       <loggername>kounta</loggername>
                       <logbackappenderfilename>kounta</logbackappenderfilename>
                       <logbackclasses>
                              <logbackclass>
                                     <logbackclassname>com.crm.kounta.webapi.KOUNTAUtilBean</logbackclassname>
                              </logbackclass>
                       </logbackclasses> 
               </logbacklogger>
       </logbackloggers>
</logbackconfig>

Use logger

If the file extends CRMBase:

Use logger
public void doSomething(CRMDOAccountingPeriod accountingPeriod) throws Exception {
	logger.debug("Invoked doSomething()");
}

If the file does not extend CRMBase:

Use logger
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:

Use logger
public void doSomething(CRMDOAccountingPeriod accountingPeriod) throws Exception {
	Logger logger = LogUtil.getLogger(getClass());
	logger.debug("Invoked doSomething()");
}
  • No labels