title: gradle build hangs when using azure application insights appender in logback.xml
body: <p>I am using azure application insights for logging in my application, It is a spring boot application with gradle. I am using application insights as an appender in my logback.xml
  The application works fine and logging works fine. But when I try to build my  application using "gradle build" the build gets stuck and runs forever.   </p>
  
  <p><a href="https://i.stack.imgur.com/UquaT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UquaT.png" alt="enter image description here"></a></p>
  
  <p>The application builds fine if the application insights appender is removed from logback.xml file. I tried adding ApplicationInsights.xml and still the issue exists   </p>
  
  <p>My build.gradle is as below. </p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
          jcenter()
          maven { url "http://repo.spring.io/plugins-release" }
          maven { url "http://plugins.gradle.org/m2/" }
      }
      dependencies {
          classpath "org.springframework.boot:spring-boot-gradle-plugin:${spring_boot_version}"
          classpath "io.spring.gradle:propdeps-plugin:${propdeps_plugin_version}"
          classpath "gradle.plugin.org.detoeuf:swagger-codegen-plugin:${swagger_codegen_version}"
          classpath "net.ltgt.gradle:gradle-apt-plugin:${net_ltgt_version}"
          classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:${sonar_version}"
      }
  }
  
  // Apply the java-library plugin to add support for Java Library
  apply plugin: 'java'
  apply plugin: 'java-library'
  apply plugin: 'maven'
  apply plugin: 'eclipse'
  apply plugin: 'org.springframework.boot'
  apply plugin: 'io.spring.dependency-management'
  apply plugin: 'net.ltgt.apt'
  apply plugin: 'org.sonarqube'
  apply plugin: 'jacoco'
  
  group = 'com.test.project'
  version = '0.0.1-SNAPSHOT'
  sourceCompatibility = 1.8 
  
  repositories {
      mavenCentral()
      jcenter()
      maven { url "https://repo.spring.io/milestone" }
      mavenLocal()
      flatDir {
         dirs 'libs'
      }
  }
  
  dependencies {
      api "org.springframework.boot:spring-boot-starter-web"
      api "org.springframework.boot:spring-boot-starter-actuator"
      api "org.springframework.boot:spring-boot-starter-jetty"
      api "org.springframework.boot:spring-boot-starter-data-jpa"
      api "org.springframework.boot:spring-boot-starter-security"
      api "org.springframework.security.oauth:spring-security-oauth2"
  
      api "org.springframework.cloud:spring-cloud-starter-config"
      api "org.springframework.cloud:spring-cloud-security:${spring_cloud_security_version}"
      api "io.springfox:springfox-swagger2:${swagger_version}"
      api "io.springfox:springfox-swagger-ui:${swagger_version}"
      api ("net.sf.dozer:dozer:${dozer_version}") {
          exclude group: "org.slf4j", module: "slf4j-log4j12"
      }
      api "com.zaxxer:HikariCP:${hikari_version}"
      api "org.postgresql:postgresql:${postgres_version}"
      api "org.hibernate:hibernate-java8"
      api "io.jsonwebtoken:jjwt:0.9.0"
      api "org.springframework.boot:spring-boot-starter-quartz"
      api "org.quartz-scheduler:quartz:2.2.3"
      api "org.quartz-scheduler:quartz-jobs:2.2.3"
      api "org.springframework:spring-jdbc:4.2.4.RELEASE"
  
      api "com.microsoft.azure:applicationinsights-spring-boot-starter:1.0.0-BETA"
      api "com.microsoft.azure:applicationinsights-logging-logback:2.0.+"
  
      compileOnly "org.projectlombok:lombok:${lombok_version}"
      annotationProcessor "org.projectlombok:lombok:${lombok_version}"
  
      // Use JUnit test framework
      testImplementation "junit:junit:${junit_version}"
      testImplementation "org.springframework.boot:spring-boot-starter-test"
      testImplementation "javax.servlet:javax.servlet-api:${javax_servlet_version}"
      testImplementation "io.rest-assured:rest-assured:${rest_assured_version}"
      testImplementation "io.rest-assured:spring-mock-mvc:${rest_assured_version}"
      testImplementation "com.h2database:h2"
      testImplementation "org.hsqldb:hsqldb"
      testImplementation "com.github.tomakehurst:wiremock:2.6.0"
      testImplementation "org.powermock:powermock-module-junit4:2.0.0-beta.5"
      testImplementation "org.powermock:powermock-api-mockito2:2.0.0-beta.5"
  
  }
  
  dependencyManagement {
      imports {
          mavenBom "com.microsoft.azure:azure-spring-boot-bom:${spring_azure_version}"
          mavenBom "org.springframework.cloud:spring-cloud-dependencies:${spring_cloud_version}"
      }
  }
  </code></pre>
  
  <p>My logback.xml is</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
  
      &lt;property name="LOG_FILE" value="logs/project_name" /&gt;
      &lt;property name="LOG_PATTERN"
          value="%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n" /&gt;
  
      &lt;appender name="CONSOLE"
          class="ch.qos.logback.core.ConsoleAppender"&gt;
          &lt;layout class="ch.qos.logback.classic.PatternLayout"&gt;
              &lt;pattern&gt;${LOG_PATTERN}&lt;/pattern&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;appender name="ROLLINGFILE"
          class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
          &lt;encoder
              class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"&gt;
              &lt;pattern&gt;${LOG_PATTERN}&lt;/pattern&gt;
          &lt;/encoder&gt;
  
          &lt;rollingPolicy
              class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"&gt;
  
              &lt;!-- daily rollover --&gt;
              &lt;fileNamePattern&gt;${LOG_FILE}.%d{yyyy-MM-dd-HH}.%i.log&lt;/fileNamePattern&gt;
              &lt;maxHistory&gt;10&lt;/maxHistory&gt;
              &lt;timeBasedFileNamingAndTriggeringPolicy
                  class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"&gt;
                  &lt;maxFileSize&gt;100MB&lt;/maxFileSize&gt;
              &lt;/timeBasedFileNamingAndTriggeringPolicy&gt;
          &lt;/rollingPolicy&gt;
      &lt;/appender&gt;
  
      &lt;appender name="aiAppender" 
          class="com.microsoft.applicationinsights.logback.ApplicationInsightsAppender"&gt; 
      &lt;/appender&gt; 
  
      &lt;root level="ERROR"&gt;
          &lt;appender-ref ref="CONSOLE" /&gt;
          &lt;appender-ref ref="ROLLINGFILE" /&gt;
          &lt;appender-ref ref="aiAppender" /&gt; 
      &lt;/root&gt;
  
      &lt;logger name="org.springframework" level="ERROR" /&gt;
      &lt;logger name="org.hibernate.engine" level="ERROR" /&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>My application.yml properties are</p>
  
  <pre><code>project:
      artifactId: project-artifact
      name: Project name
      version: 0.0.1-SNAPSHOT
      description: Project desc
  
  server:
    port: 8080
    servlet:
       contextPath: /api
  
  azure:
     application-insights:
        instrumentation-key: instrumentation-key
        enabled: true
        web:
           enabled: true
  </code></pre>
  
  <p>I tried adding ApplicationInsights.xml as below but still the build hangs</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings" schemaVersion="2014-05-30"&gt;
  
  
    &lt;!-- The key from the portal: --&gt;
  
    &lt;InstrumentationKey&gt;instrumentation key&lt;/InstrumentationKey&gt;
  
  
    &lt;!-- HTTP request component (not required for bare API) --&gt;
  
    &lt;TelemetryModules&gt;
      &lt;Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebRequestTrackingTelemetryModule"/&gt;
      &lt;Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebSessionTrackingTelemetryModule"/&gt;
      &lt;Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebUserTrackingTelemetryModule"/&gt;
    &lt;/TelemetryModules&gt;
  
    &lt;!-- Events correlation (not required for bare API) --&gt;
    &lt;!-- These initializers add context data to each event --&gt;
  
    &lt;TelemetryInitializers&gt;
      &lt;Add   type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationIdTelemetryInitializer"/&gt;
      &lt;Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationNameTelemetryInitializer"/&gt;
      &lt;Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebSessionTelemetryInitializer"/&gt;
      &lt;Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserTelemetryInitializer"/&gt;
      &lt;Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserAgentTelemetryInitializer"/&gt;
  
    &lt;/TelemetryInitializers&gt;
  &lt;/ApplicationInsights&gt;
  </code></pre>
  
  <p>Please suggest if I am missing anything </p>