Announcement Announcement Module
Collapse
No announcement yet.
Spring Shell: Startup and shutdown LOGs Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Shell: Startup and shutdown LOGs

    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.
    The 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:


    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.[email protected]: 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.[email protected]: startup date [Tue Mar 04 09:51:17 BRT 2014]; parent: org.springframework.context.annotation.[email protected] Destroying singletons in org.springframework.beans.factory.support.[email protected]: defining beans [readContainerCmd,getSubscriberAccountDetailsCmd,re moveContainerCmd,addContainerCmd,getSubscriberDeta ilsCmd,org.springframework.context.annotation.inte rnalConfigurationAnnotationProcessor,org.springfra mework.context.annotation.internalAutowiredAnnotat ionProcessor,org.springframework.context.annotatio n.internalRequiredAnnotationProcessor,org.springfr amework.context.annotation.internalCommonAnnotatio nProcessor,deleteSubscriberCmd,createSubscriberCmd ,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPos tProcessor#0]; parent: org.springframework.beans.factory.support.DefaultL [email protected] :
    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.


  • #2
    I could figure out by myself what the issue.
    Basically, Spring shell is using the JDK logging tool.... so it's possible to disable changing this confguration: JRE_DIRECTORY/lib/logging.properties
    In my case, this configuration files is in:
    /usr/jdk/instances/jdk1.6.0/jre/lib/logging.properties... you can just change the log level from:
    .level= INFO
    to
    .level= SEVERE

    It's also possible to pass a new configuration file as:
    java -Djava.util.logging.config.file=mylogging.propertie s

    Comment

    Working...
    X