-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris,

On 6/9/2009 9:46 AM, Christopher Piggott wrote:
> I'm running tomcat 6 and am having the problem that swallowOutput
> doesn't work for my service threads (i.e. threads owned by the webapp,
> created in ServletContextListener.contextInitialized() and managed
> entirely by me).

(By the way, did you solve your other problem of not getting *any*
stdout output swallowed when swallowOutput="true"?)

> I noticed that swallowOutput="true" doesn't seem to affect these child
> threads.  Is there something that I have to do when I initialize my
> service thread to map its stdout/stderr to the rest of the webapp's,
> so that swallowOutput works on these children?

You may have to set the thread's context classloader like this:

public void contextInitialized(...)
{
   Thread t = new Thread();

   t.setContextClassLoader(Thread.currentThread()
                           .getContextClassLoader());
}

The javadoc for setContextClassLoader /plus/ a recent post on this list
indicate that you might have to specifically enable a permission for
this method in order to run successfully under a SecurityManager.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkouvMAACgkQ9CaO5/Lv0PA0wACfVBJ8lkdHF2xslIIJXLW4iby6
JLAAoLNjQ1pq1BrQGU2z2vYoQaUSRNwb
=TcFR
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to