users@glassfish.java.net

Re: thread name in log messages?

From: Bobby Bissett <bbissett_at_gmail.com>
Date: Mon, 10 Sep 2012 09:08:50 -0400

On Mon, Sep 10, 2012 at 8:05 AM, Lachezar Dobrev <l.dobrev_at_gmail.com> wrote:
> I hope I am not going to hijack the thread, but is there an option
> to have the application's name and/or the application module's name in
> the log?

Would it work for you just to use different logger names in different
applications? The logger name is included in the log message, so you
can always filter/grep for logger name to get only your app's
messages.

[...]
> Is it possible, that the Thread Name is generated, rather than
> obtained from the Thread?

What I was hoping for in my original question is that the thread name
would be neither: Ideally I'd like it to be the name of the the thread
that logged the message and not whatever thread is managing logging in
GlassFish. That way if you give your threads meaningful names, you can
match what's in the log better with what your app is doing (and match
jstack output). See the example output in my first message where the
logged thread name != the name of the thread in my app.

Cheers,
Bobby