package com.commercetools;

import com.commercetools.pspadapter.payone.*;
import com.commercetools.pspadapter.payone.config.PropertyProvider;
import com.commercetools.pspadapter.payone.config.ServiceConfig;
import org.quartz.CronScheduleBuilder;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static java.lang.String.format;

public class Main {

    private static final Logger LOG = LoggerFactory.getLogger(Main.class);

    /**
     * It is recommended to run this service using {@code ./gradlew :service:run}
     * or {@code ./gradlew :service:runShadow} command - this will parse mandatory environment
     * variables from {@code gradle.properties} file.
     * Most of IDE should support Run/Debug configuration to run such gradle tasks.
     * <p>
     * See more in {@code Project-Lifecycle.md} documentation.
     *
     * @param args default command line args (ignored so far)
     * @throws SchedulerException if scheduled quartz jobs can't be started
     */
    public static void main(String[] args) throws SchedulerException {

        final PropertyProvider propertyProvider = new PropertyProvider();
        final ServiceConfig serviceConfig = new ServiceConfig(propertyProvider);

        final IntegrationService integrationService = ServiceFactory.createIntegrationService(propertyProvider, serviceConfig);
        integrationService.start();

        ScheduledJobFactory scheduledJobFactory = new ScheduledJobFactory();

        scheduledJobFactory.setAllScheduledItemsStartedListener(() ->
                LOG.info(format("Application has started with name:[%s] and version:[%s].",
                    serviceConfig.getApplicationName(),
                    serviceConfig.getApplicationVersion()))
        );

        scheduledJobFactory.createScheduledJob(
                CronScheduleBuilder.cronSchedule(serviceConfig.getScheduledJobCronForShortTimeFramePoll()),
                ScheduledJobShortTimeframe.class,
                integrationService);

        scheduledJobFactory.createScheduledJob(
                CronScheduleBuilder.cronSchedule(serviceConfig.getScheduledJobCronForLongTimeFramePoll()),
                ScheduledJobLongTimeframe.class,
                integrationService);
    }
}

@@ -333,16 +333,60 @@
 Factory;
+%0Aimport org.slf4j.bridge.SLF4JBridgeHandler;
 %0A%0Aimport
@@ -1136,16 +1136,44 @@
 eption %7B
+%0A        bridgeJULToSLF4J();
 %0A%0A      
@@ -2295,32 +2295,32 @@
 imeframe.class,%0A
-
                 
@@ -2345,11 +2345,749 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Routes all incoming j.u.l. (java.util.logging.Logger) records to the SLF4j API. This is done by:%0A     * %3Col%3E%0A     *     %3Cli%3ERemoving existing handlers attached to the j.u.l root logger.%3C/li%3E%0A     *     %3Cli%3EAdding SLF4JBridgeHandler to j.u.l's root logger.%3C/li%3E%0A     * %3C/ol%3E%0A     * %3Cp%3EWhy we do the routing?%0A     * %3Cp%3ESome dependencies (e.g. org.javamoney.moneta's DefaultMonetaryContextFactory) log events using the%0A     * j.u.l. This causes such logs to ignore the logback.xml configuration which is only%0A     * applied to logs from the SLF4j implementation.%0A     *%0A     */%0A    private static void bridgeJULToSLF4J() %7B%0A        SLF4JBridgeHandler.removeHandlersForRootLogger();%0A        SLF4JBridgeHandler.install();%0A    %7D
 %0A%7D%0A

Add SLF4J bridge.