Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何停止弹簧&x27;什么是默认输出?_Java_Spring_Logging - Fatal编程技术网

Java 如何停止弹簧&x27;什么是默认输出?

Java 如何停止弹簧&x27;什么是默认输出?,java,spring,logging,Java,Spring,Logging,我是春天的新手。当我运行Spring批处理应用程序时,我只希望看到“Hello World!”,但是,我得到了以下附加细节- May 03, 2012 12:28:42 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationConte

我是春天的新手。当我运行Spring批处理应用程序时,我只希望看到“Hello World!”,但是,我得到了以下附加细节-

May 03, 2012 12:28:42 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@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.springframework.beans.factory.support.DefaultListableBeanFactory@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.springframework.context.support.ClassPathXmlApplicationContext@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.springframework.beans.factory.support.DefaultListableBeanFactory@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 2012年5月3日下午12:28:42 org.springframework.context.support.AbstractApplicationContext prepareRefresh 信息:刷新org.springframework.context.support。ClassPathXmlApplicationContext@4e660b27:启动日期[Thu May 03 12:28:42 EDT 2012];上下文层次结构的根 2012年5月3日下午12:28:42 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息:从类路径资源[helloWorldJob.XML]加载XMLBean定义 2012年5月3日下午12:28:43 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息:从类路径资源[MEMORY-JOBREPOSITORY.XML]加载XMLBean定义 2012年5月3日12:28:44 PM org.springframework.beans.factory.support.DefaultListableBeanFactory注册表BeanDefinition 信息:覆盖bean“helloWorldJob”的bean定义:替换[genericbean: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;destromethodName=null]与[Generic bean:class[org.springframework.batch.core.configuration.xml.JobParserJobFactoryBean];scope=;abstract=false;lazyInit=false;autowireMode=0;dependencyCheck=0;autowirelated=true;primary=false;factoryBeanName=null;factoryMethodName=null;initMethodName=null;destroyMethodName=null] 2012年5月3日12:28:44 PM org.springframework.beans.factory.support.DefaultListableBeanFactory预实例化单例 信息:在org.springframework.beans.factory.support中预实例化单例。DefaultListableBeanFactory@63dfb24d:定义bean[jobRepository,jobRepository transactionManager,jobLauncher,hello,world,org.springframework.batch.core.scope.internalStepScope,org.springframework.beans.factory.config.CustomEditorConfigure,org.springframework.batch.core.configuration.xml.CoreNamespacePostProcessor,step0,step1,helloWorldJob];工厂层次结构的根 2012年5月3日下午12:28:44 org.springframework.aop.framework.defaultaopproxy工厂 信息:CGLIB2可用:proxyTargetClass功能已启用 2012年5月3日下午12:28:44 org.springframework.batch.core.launch.support.simplejoblancher AfterPropertieSet 信息:未设置TaskExecutor,默认为synchronous executor。 2012年5月3日下午12:28:44 org.springframework.batch.core.launch.support.SimpleZoblancher$1运行 信息:作业:[FlowJob:[name=helloWorldJob]]使用以下参数启动:[{time=11:06AM}] 2012年5月3日下午12:28:44 org.springframework.batch.core.job.simplestphandler handleStep 信息:正在执行步骤:[step0] HelloMay 032012 12:28:44 PM org.springframework.batch.core.job.simplestphandler handleStep 信息:执行步骤:[步骤1] World!2012年5月3日12:28:44 PM org.springframework.batch.core.launch.support.simplejoblancher$1运行 信息:作业:[FlowJob:[name=helloWorldJob]]已完成,参数如下:[{time=11:06AM}],状态如下:[已完成] 2012年5月3日下午12:28:44 org.springframework.context.support.AbstractApplicationContext doClose 信息:正在关闭org.springframework.context.support。ClassPathXmlApplicationContext@4e660b27:启动日期[Thu May 03 12:28:42 EDT 2012];上下文层次结构的根 2012年5月3日12:28:44 PM org.springframework.beans.factory.support.DefaultSingletonBean注册销毁Singleton 信息:在org.springframework.beans.factory.support中销毁单例。DefaultListableBeanFactory@63dfb24d:定义bean[jobRepository,jobRepository transactionManager,jobLauncher,hello,world,org.springframework.batch.core.scope.internalStepScope,org.springframework.beans.factory.config.CustomEditorConfigure,org.springframework.batch.core.configuration.xml.CoreNamespacePostProcessor,step0,step1,helloWorldJob];工厂层次结构的根 如何防止这些多余的东西出现?谢谢

其他信息-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>

您可以和。 这样就可以停用所有非错误日志记录


但是Dave Newton是对的:这听起来确实是个坏主意。

关闭Spring的信息级日志记录?依我看,这是一个粗略的想法——它告诉你发生了什么,是你调试时的第一个联系点。一点也不粗略。如果你有问题,那么你就提高了调试级别。很多人喜欢安静的日志。我添加了日志4j、 xml,它是我应用程序的一部分。您能告诉我应该对它做哪些更改吗?