3
14:00:04,449 INFO  [org.jboss.seam.servlet.SeamFilter] Initializing filter:
 org.jboss.seam.servlet.characterEncodingFilter
14:00:04,450 INFO  [org.jboss.seam.servlet.SeamFilter] Initializing filter:
 org.jboss.seam.web.redirectFilter
14:00:04,451 INFO  [org.jboss.seam.servlet.SeamFilter] Initializing filter:
 org.jboss.seam.web.exceptionFilter
14:00:04,452 INFO  [org.jboss.seam.servlet.SeamFilter] Initializing filter:
 org.jboss.seam.web.multipartFilter
14:00:04,452 INFO  [org.jboss.seam.servlet.SeamFilter] Initializing filter:
 org.jboss.seam.web.identityFilter
14:00:04,453 INFO  [org.jboss.seam.servlet.SeamFilter] Initializing filter:
 org.jboss.seam.web.rewriteFilter

这些是在 JBoss 6 上 JBoss SEAM 应用程序启动后打印的最后一组行。

@Name("myStartup")
@Startup
@Scope(APPLICATION)
@BypassInterceptors
public class MyStartup {

    @Create
    public void create() {
        System.out.println("SERVER STARTED SUCCESSFULLY");
    }
}

我的意图是在 SeamFilter 初始化后打印上述消息(在 JBoss 6 控制台上)。我该怎么做?

4

2 回答 2

0

如果这个想法只是在所有接缝消息之后显示一些状态,那么至少有两种方法:

首先是使用 Shervin 的解决方案并抑制org.jboss.seam.servlet.Filter INFO消息$JBOSS_HOME/server/<your-profile>/conf/jboss-log4j.xml

<category name="org.jboss.seam.servlet.Filter">
   <priority value="ERROR"/>
</category>

或者实现一个过滤器:

@Scope(APPLICATION)
@Name("com.example.seam.myFilter")
@BypassInterceptors
@Filter(within={"org.jboss.seam.web.rewriteFilter"})
public class MyFilter implements Filter {
    public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
        chain.doFilter(request, response);
    }

    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("SERVER STARTED SUCCESSFULLY");
    }
}
于 2011-07-03T10:41:48.880 回答
0

您可以在普通组件上尝试此注释。移除@Startup该组件上的 。

@Observer({"org.jboss.seam.postInitialization", "org.jboss.seam.postReInitialization"})
public void create() {
    System.out.println("SERVER STARTED SUCCESSFULLY");
}
于 2011-06-24T11:39:43.920 回答