2012-05-03 35 views
2

我是新來的春天。當我運行一個春天批處理應用程序,我希望只看到,而是,我得到以下的其他詳細信息的「Hello World!」 -如何停止Spring的默認輸出?

 
May 03, 2012 12:28:42 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh 
INFO: Refreshing org[email protected]4e660b27: startup date [Thu May 03 12:28:42 EDT 2012]; root of context hierarchy 
May 03, 2012 12:28:42 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 
INFO: Loading XML bean definitions from class path resource [helloWorldJob.xml] 
May 03, 2012 12:28:43 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 
INFO: Loading XML bean definitions from class path resource [MEMORY-JOBREPOSITORY.xml] 
May 03, 2012 12:28:44 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition 
INFO: Overriding bean definition for bean 'helloWorldJob': replacing [Generic bean: class [org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.batch.core.configuration.xml.JobParserJobFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] 
May 03, 2012 12:28:44 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons 
INFO: Pre-instantiating singletons in org.s[email protected]63dfb24d: defining beans [jobRepository,jobRepository-transactionManager,jobLauncher,hello,world,org.springframework.batch.core.scope.internalStepScope,org.springframework.beans.factory.config.CustomEditorConfigurer,org.springframework.batch.core.configuration.xml.CoreNamespacePostProcessor,step0,step1,helloWorldJob]; root of factory hierarchy 
May 03, 2012 12:28:44 PM org.springframework.aop.framework.DefaultAopProxyFactory 
INFO: CGLIB2 available: proxyTargetClass feature enabled 
May 03, 2012 12:28:44 PM org.springframework.batch.core.launch.support.SimpleJobLauncher afterPropertiesSet 
INFO: No TaskExecutor has been set, defaulting to synchronous executor. 
May 03, 2012 12:28:44 PM org.springframework.batch.core.launch.support.SimpleJobLauncher$1 run 
INFO: Job: [FlowJob: [name=helloWorldJob]] launched with the following parameters: [{time=11:06AM}] 
May 03, 2012 12:28:44 PM org.springframework.batch.core.job.SimpleStepHandler handleStep 
INFO: Executing step: [step0] 
HelloMay 03, 2012 12:28:44 PM org.springframework.batch.core.job.SimpleStepHandler handleStep 
INFO: Executing step: [step1] 
World!May 03, 2012 12:28:44 PM org.springframework.batch.core.launch.support.SimpleJobLauncher$1 run 
INFO: Job: [FlowJob: [name=helloWorldJob]] completed with the following parameters: [{time=11:06AM}] and the following status: [COMPLETED] 
May 03, 2012 12:28:44 PM org.springframework.context.support.AbstractApplicationContext doClose 
INFO: Closing org[email protected]4e660b27: startup date [Thu May 03 12:28:42 EDT 2012]; root of context hierarchy 
May 03, 2012 12:28:44 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons 
INFO: Destroying singletons in org.s[email protected]63dfb24d: defining beans [jobRepository,jobRepository-transactionManager,jobLauncher,hello,world,org.springframework.batch.core.scope.internalStepScope,org.springframework.beans.factory.config.CustomEditorConfigurer,org.springframework.batch.core.configuration.xml.CoreNamespacePostProcessor,step0,step1,helloWorldJob]; root of factory hierarchy 

如何防止這種額外的東西無法顯示?謝謝。

其他信息 - 的log4j.xml

<?xml version="1.0" encoding="UTF-8" ?> 
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> 
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> 

    <appender name="appender" class="org.apache.log4j.FileAppender"> 
    <param name="File" value="helloWorld-Log.txt"/> 
    <param name="Append" value="false"/> 
    <layout class="org.apache.log4j.PatternLayout"> 
     <param name="ConversionPattern" value="%d [%t] %p - %m%n"/> 
    </layout> 
    </appender> 
    <appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender"> 
    <layout class="org.apache.log4j.SimpleLayout"/> 
    </appender> 
    <root> 
    <priority value ="ERROR"/> 
    <appender-ref ref="ConsoleAppender"/> 
    </root> 

</log4j:configuration> 
+2

關閉Spring的INFO級日誌記錄?國際海事組織,一個粗略的想法 - 這是什麼告訴你發生了什麼,並且是調試時的第一個聯繫點。 –

+3

一點也不粗略。如果你遇到問題,那麼你調試一級。很多人喜歡安靜的日誌。 –

回答