AKA:如何配置Spring-Boot + JBOSS 7.1服务器的日志记录
尝试针对较旧的JBoss 7.1服务器实例部署spring-boot应用程序(客户要求。)
我最初使用的是一个在Tomcat下运行良好的项目但是当我将它部署到JBoss时,它会发出你在下面看到的日志记录错误。我通过Google找到了jboss-structure.xml更改和build.gradle依赖项的常见嫌疑。我仍然保持指出的错误。
我正在使用:Spring-Boot 1.3.5,对于这个问题的例子,我正在直接从http://start.spring.io进行全新构建,并在没有任何修改的情况下部署它。
的build.gradle:
buildscript {
ext {
springBootVersion = '1.3.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'spring-boot'
apply plugin: 'war'
war {
baseName = 'demo'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
configurations {
providedRuntime
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-data-rest')
compile('org.springframework.boot:spring-boot-starter-mustache')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-ws')
runtime('com.h2database:h2')
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}
的server.log
2016-06-02 13:10:37,946 INFO [org.jboss.as.server.deployment] (MSC service thread 1-18) | DeploymentServiceListener constructor for deployment demo-0.0.1-SNAPSHOT.war]
2016-06-02 13:10:37,947 INFO [org.jboss.as.server.deployment] (MSC service thread 1-18) | JBAS015876: Starting deployment of "demo-0.0.1-SNAPSHOT.war"
2016-06-02 13:10:39,069 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-14) | MSC00001: Failed to start service jboss.deployment.unit."demo-0.0.1-SNAPSHOT.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."demo-0.0.1-SNAPSHOT.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "demo-0.0.1-SNAPSHOT.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:123) [jboss-as-server-7.1.2.Final.jar:7.1.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011555: Failed to configure logging using 'logging.properties' configuration file.
at org.jboss.as.logging.LoggingConfigurationProcessor.deploy(LoggingConfigurationProcessor.java:125)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116) [jboss-as-server-7.1.2.Final.jar:7.1.2.Final]
... 5 more
Caused by: java.lang.IllegalArgumentException: className is null
at org.jboss.logmanager.config.AbstractPropertyConfiguration.<init>(AbstractPropertyConfiguration.java:52) [jboss-logmanager-1.3.1.Final.jar:1.3.1.Final]
at org.jboss.logmanager.config.HandlerConfigurationImpl.<init>(HandlerConfigurationImpl.java:54) [jboss-logmanager-1.3.1.Final.jar:1.3.1.Final]
at org.jboss.logmanager.config.LogContextConfigurationImpl.addHandlerConfiguration(LogContextConfigurationImpl.java:138) [jboss-logmanager-1.3.1.Final.jar:1.3.1.Final]
at org.jboss.logmanager.PropertyConfigurator.configureHandler(PropertyConfigurator.java:477) [jboss-logmanager-1.3.1.Final.jar:1.3.1.Final]
at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:379) [jboss-logmanager-1.3.1.Final.jar:1.3.1.Final]
at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:92) [jboss-logmanager-1.3.1.Final.jar:1.3.1.Final]
at org.jboss.as.logging.LoggingConfigurationProcessor.deploy(LoggingConfigurationProcessor.java:122)
... 6 more
2016-06-02 13:10:39,071 INFO [org.jboss.as.server] (host-controller-connection-threads - 9) | JBAS015870: Deploy of deployment "demo-0.0.1-SNAPSHOT.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"demo-0.0.1-SNAPSHOT.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"demo-0.0.1-SNAPSHOT.war\".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment \"demo-0.0.1-SNAPSHOT.war\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011555: Failed to configure logging using 'logging.properties' configuration file.
Caused by: java.lang.IllegalArgumentException: className is null"}}
2016-06-02 13:10:39,095 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) | JBAS015877: Stopped deployment demo-0.0.1-SNAPSHOT.war in 23ms
答案 0 :(得分:2)
采取了3个步骤,以便使用有用的日志记录...
export JAVA_OPTS=-Dorg.jboss.as.logging.per-deployment=false
compile('org.slf4j:slf4j-api:1.7.5')
添加到我的build.gradle logger.level=INFO
logger.handlers=FILE,CONSOLE
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.properties=autoFlush
handler.CONSOLE.level=INFO
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=PATTERN
handler.FILE=org.jboss.logmanager.handlers.FileHandler
handler.FILE.level=DEBUG
handler.FILE.properties=autoFlush,fileName
handler.FILE.autoFlush=true
handler.FILE.fileName=bridge.log
handler.FILE.formatter=PATTERN
formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.PATTERN.properties=pattern
formatter.PATTERN.pattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n