Я использую данные приложения Azure для входа в свое приложение. Это приложение с весенней загрузкой и Gradle. Я использую понимание приложения в качестве приложения в моем logback.xml
Приложение работает нормально, а логирование работает нормально. Но когда я пытаюсь собрать свое приложение, используя "gradle build", сборка застревает и работает вечно.
Приложение прекрасно собирается, если приложение app insights app удалено из файла logback.xml. Я попытался добавить ApplicationInsights.xml, но проблема все еще существует
Мой build.gradle, как показано ниже.
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}"
}
}
Мой logback.xml -
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOG_FILE" value="logs/project_name" />
<property name="LOG_PATTERN"
value="%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n" />
<appender name="CONSOLE"
class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>${LOG_PATTERN}</pattern>
</layout>
</appender>
<appender name="ROLLINGFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd-HH}.%i.log</fileNamePattern>
<maxHistory>10</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
<appender name="aiAppender"
class="com.microsoft.applicationinsights.logback.ApplicationInsightsAppender">
</appender>
<root level="ERROR">
<appender-ref ref="CONSOLE" />
<appender-ref ref="ROLLINGFILE" />
<appender-ref ref="aiAppender" />
</root>
<logger name="org.springframework" level="ERROR" />
<logger name="org.hibernate.engine" level="ERROR" />
</configuration>
Мои свойства application.yml
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
Я попытался добавить ApplicationInsights.xml, как показано ниже, но сборка все еще зависает
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings" schemaVersion="2014-05-30">
<!-- The key from the portal: -->
<InstrumentationKey>instrumentation key</InstrumentationKey>
<!-- HTTP request component (not required for bare API) -->
<TelemetryModules>
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebRequestTrackingTelemetryModule"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebSessionTrackingTelemetryModule"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebUserTrackingTelemetryModule"/>
</TelemetryModules>
<!-- Events correlation (not required for bare API) -->
<!-- These initializers add context data to each event -->
<TelemetryInitializers>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationIdTelemetryInitializer"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationNameTelemetryInitializer"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebSessionTelemetryInitializer"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserTelemetryInitializer"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserAgentTelemetryInitializer"/>
</TelemetryInitializers>
</ApplicationInsights>
Пожалуйста, предложите, если я что-то упустил