Good Morning Bill- It appears this is a synchronisation issue as you are not obtaining a lock on the object until both the Super class and your class are both being initialised (without exception)
the quickest workaround is to declare the static field as final OR lock the object and then manipulate the objects (thru initialisation) while the thread is locked and then release the lock.. Take a look at http://java.sun.com/docs/books/jls/second_edition/html/execution.doc.html#44557 for relevant information.. Anyone else? Martin- ----- Original Message ----- From: "Bill Comer" <[EMAIL PROTECTED]> To: "Tomcat Users List" <users@tomcat.apache.org> Sent: Friday, December 23, 2005 9:59 AM Subject: Re: redirecting logging messages from a thread within a servlet Cheers Boris but I had already tried that, but with no luck I am afraid. Yes I am using java.util.logging.Logger. Regards, Bill On 12/23/05, Boris Unckel <[EMAIL PROTECTED]> wrote: > Hello Bill, > > may be the following changes can help. I assume you are using > java.util.logging.Logger > > Bill Comer wrote: > > Any ideas how this can be resolved ? > > > > thanks in advance. > > Bill > > > > Below is a code snippet. > > > > public class BillTestServlet extends BaseServlet { > > > > private final Logger logger = > > Logger.getLogger(BillTestServlet.class.getName()); > > > > public void init(ServletConfig servletConfig) throws ServletException { > > super.init(servletConfig); > > } > > > > public void doPost(HttpServletRequest req, HttpServletResponse > > res) throws ServletException, > > IOException { > > doGet(req, res); > > } > > > > /* > > * This last string in this competition is a number > > */ > > public void doGet(HttpServletRequest req, HttpServletResponse res) > > throws IOException { > > > > logger.info("before sleep"); > > try { > > DoSomethingThread doSomethingThread = new DoSomethingThread(); > > doSomethingThread.start(); > > } catch (Exception e) { > > } > > logger.info("after sleep"); > > > > acknowledge(res, "boo"); > > } > > > > class DoSomethingThread extends Thread { > > private final Logger localLogger = > > Logger.getLogger(BillTestServlet.class.getName()); > > > > > > public void run() { > > localLogger.info("start run"); > > try { > > Thread.sleep(2000); > > } catch (Exception e) { > > } > > localLogger.info("end run"); > > } > > } > > } > Regards > Boris > > Extensions for java.util.logging > http://www.x4juli.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]