-
2. Re: Why is wildfly eating my stdios?
tchize Aug 21, 2014 8:15 AM (in response to ctomc)I don't see how that message relates to my question. This other thread mention why Main in a standalone console application replaces System.in, which obviously is a bug. Here i'd like to know what are the rules in wildfly relating to stdout/stderr during normal webapplication lifecycle and how to configure it, more specifically in the case of servlet filter.
-
3. Re: Why is wildfly eating my stdios?
jamezp Aug 22, 2014 5:57 PM (in response to tchize)You shouldn't be getting a NullOutputStream from STDIO. There is a DelegatingPrintStream that extends PrintStream and initializes the super class with a NullOutputStream, but all methods should be overridden. Nothing should be executing on the NullOutputStream.
The stdout should be going to a logger with the category "stdout" and stderr should be going to a logger with the category "stderr".
--
James R. Perkins -
4. Re: Why is wildfly eating my stdios?
tchize Aug 25, 2014 4:14 AM (in response to jamezp)I agree I shouldn't, but it is a fact that is what I get it. During servlet / jsp / inside JSB beans everything is properly redirected to stdout logger. But during servlet filter, it's not the case. It's neither the case before calling rest of the filter chain, nor after calling it. Where should I start investigations to find out what causes it?
-
5. Re: Why is wildfly eating my stdios?
jaikiran Aug 25, 2014 6:35 AM (in response to tchize)I think it's fair to expect the System.out and System.err logs from any component within a web application to be seen on the console (or wherever they are redirected to). If that isn't happening then, IMO, that's a bug. You can create a JIRA here WildFly - JBoss Issue Tracker explaining the problem and pointing to this discussion. If possible attach a sample application which reproduces this.
-
6. Re: Re: Why is wildfly eating my stdios?
jamezp Aug 25, 2014 8:08 PM (in response to tchize)I just tested a very simple filter on WidFly 8.1.0.Final and it worked fine for me.
package org.jboss.example.servlet; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; /** * @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a> */ @WebFilter(filterName = "TestFilter", urlPatterns = "/*") public class TestFilter implements Filter { public void destroy() { System.out.println("From destroy"); } public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException { chain.doFilter(req, resp); System.out.println("From doFilter"); } public void init(FilterConfig config) throws ServletException { System.out.println("From init"); } }
I saw all the messages printed on the console:
17:04:16,154 INFO [stdout] (default task-1) From init 17:04:16,162 INFO [stdout] (default task-1) From doFilter 17:04:27,495 INFO [simple] (default task-3) This is just a test
--
James R. Perkins