Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is meaning of the number after exec in "[http-bio-8080-exec-494] [ERROR]"?

While going through an investigation in a legacy Java Spring Maven project deployed on tomcat 7 the logs stated like below-

2018-08-29 18:16:42:471 +0600 [http-bio-8080-exec-494] [ERROR]

Asking to demystify the number after

exec-

So basically the meaning of "exec"? which is 494 for the above case.

like image 957
M.A.K. Simanto Avatar asked Oct 14 '25 08:10

M.A.K. Simanto


2 Answers

It's most probably the thread id generated by a custom ThreadFactory, just like:

Executor executor = Executors.newFixedThreadPool(4, new ThreadFactory() {
    AtomicInteger threadId = new AtomicInteger(0);
    @Override
    public Thread newThread(Runnable r) {
        return new Thread(r, "http-bio-8080-exec-" + threadId.getAndIncrement());   // custom a thread factory 
    }
});

IntStream.range(0, 10).forEach(value -> {
    executor.execute(() -> {    
        System.out.println(Thread.currentThread().getName());   // print thread name
        try {
            Thread.sleep(100);
        } catch (Exception e) {

        }
    });
});

OutPut:

http-bio-8080-exec-0
http-bio-8080-exec-1
http-bio-8080-exec-2
http-bio-8080-exec-3
http-bio-8080-exec-0
http-bio-8080-exec-3
http-bio-8080-exec-1
http-bio-8080-exec-2
http-bio-8080-exec-0
http-bio-8080-exec-3
like image 143
xingbin Avatar answered Oct 16 '25 23:10

xingbin


That is a Thread ID number generated by a Thread Pool in tomcat. The real question is different, this being an internal information what is the value of it, now that you know about it? I'd assume close to zero...

like image 43
Eugene Avatar answered Oct 16 '25 23:10

Eugene



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!