2

I'm quite new on Spring Shell framework. I've built/programmed the Spring Shell using the maven (mvn) repository/tool. It's quite easy to create/add new commands on it.

I issue that I have found is around the start up and shutdown of the Spring Shell application, because it output some LOGs in this processes which I couldn't disable then.

java -jar target/spring-shell-demo-1.0-SNAPSHOT.jar
Mar 04, 2014 9:47:20 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@d90727: startup date [Tue Mar 04 09:47:20 BRT 2014]; root of context hierarchy
Mar 04, 2014 9:47:20 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
:

--

spring-shell>quit
Closing org.springframework.context.support.ClassPathXmlApplicationContext@173180c: startup date [Tue Mar 04 09:51:17 BRT 2014]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@d90727
Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@f13e82: defining beans [readContainerCmd,getSubscriberAccountDetailsCmd,removeContainerCmd,addContainerCmd,getSubscriberDetailsCmd,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,deleteSubscriberCmd,createSubscriberCmd,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@1f7d3b1
:

I thought that it could be a log4j configuration, so I have create the log4j.xml configuration as:

src/main/resources$ cat 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>

I was expecting that this could remove those INFO logs from start up and shutdown, but it is still the same. As you can see i have create the log4j.xml at resource folder... I'm not sure it should be in another path, but I've tried to put in almost every place.

I would appreciate any help/tips on how to work out on this.

Regards,

Additional information of Spring Shell configuration:

src/main/resources/META-INF/spring$ cat spring-shell-plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:context="http://www.springframework.org/schema/context"
 xsi:schemaLocation="
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

 <context:component-scan base-package="com.xx.yy" />
 <context:component-scan base-package="com.xx.zz" />

</beans>
ebottard
  • 1,997
  • 2
  • 12
  • 14
Helio Aymoto
  • 303
  • 2
  • 5
  • 16

1 Answers1

0

This works for me:

public static void main(String[] args) throws IOException {
        LogManager.getLogManager().reset();
        Bootstrap.main(args);
}
Sarty
  • 1