use of org.apache.camel.component.braintree.internal.BraintreeLogHandler in project camel by apache.
the class BraintreeConfiguration method newBraintreeGateway.
/**
* Construct a BraintreeGateway from configuration
*/
synchronized BraintreeGateway newBraintreeGateway() {
final BraintreeGateway gateway = new BraintreeGateway(getBraintreeEnvironment(), getMerchantId(), getPublicKey(), getPrivateKey());
if (ObjectHelper.isNotEmpty(proxyHost) && ObjectHelper.isNotEmpty(proxyPort)) {
gateway.setProxy(proxyHost, proxyPort);
}
if (httpReadTimeout != null) {
gateway.getConfiguration().setTimeout(httpReadTimeout);
}
// If custom log name is defined, a new logger wil be requested otherwise
// the one supplied by Braintree' SDK will be used
final Logger logger = ObjectHelper.isNotEmpty(httpLogName) ? Logger.getLogger(httpLogName) : gateway.getConfiguration().getLogger();
// Cleanup handlers as by default braintree install a ConsoleHandler
for (Handler handler : logger.getHandlers()) {
logger.removeHandler(handler);
}
logger.addHandler(new BraintreeLogHandler());
if (httpLogLevel != null) {
logger.setLevel(httpLogLevel);
}
gateway.getConfiguration().setLogger(logger);
return gateway;
}
Aggregations