You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Behrang Saeedzadeh <be...@gmail.com> on 2019/10/26 09:34:58 UTC

What's the purpose of this exception?

From Tomcat Embedded Core 9.0.26:

@Override
protected void doClose() {
   if (log.isDebugEnabled()) {
      log.debug("Calling [" + getEndpoint() + "].closeSocket([" + this +
"])", new Exception());
   }

Which will log something like:

DEBUG [http-nio-8080-exec-2]
    org.apache.tomcat.util.net.NioEndpoint
        Calling [org.apache.tomcat.util.net.NioEndpoint@654c1a54].
closeSocket([org.apache.tomcat.util.net.NioEndpoint$
NioSocketWrapper@39e9d240:org.apache.tomcat.util.net.NioChannel@78019ed5
:java.nio.channels.SocketChannel[connected local=/127.0.0.1:8080
remote=/127.0.0.1:39988]])

java.lang.Exception: null
   at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doClose(NioEndpoint.java:1165)
[tomcat-embed-core-9.0.26.jar:9.0.26]
   at org.apache.tomcat.util.net.SocketWrapperBase.close(SocketWrapperBase.java:394)
[tomcat-embed-core-9.0.26.jar:9.0.26]
   at org.apache.tomcat.util.net.NioEndpoint$Poller.
cancelledKey(NioEndpoint.java:667) [tomcat-embed-core-9.0.26.jar:9.0.26]
   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1592)
[tomcat-embed-core-9.0.26.jar:9.0.26]
   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
[tomcat-embed-core-9.0.26.jar:9.0.26]
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[na:1.8.0_212]
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[na:1.8.0_212]
   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
[tomcat-embed-core-9.0.26.jar:9.0.26]
   at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]

To print the stack trace next to the message? Why not only print the stack
trace next to the log message using
org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace for
example? The presence of the `java.lang.Exception: null` in the logs is a
bit misleading and confusing.

Best regards,
Behrang Saeedzadeh
blog.behrang.org

Re: What's the purpose of this exception?

Posted by Behrang Saeedzadeh <be...@gmail.com>.
I thought this mailing list better suited for the question as it's about
Tomcat's source code.

On Sat, 26 Oct. 2019, 9:16 pm Mark Thomas, <ma...@homeinbox.net> wrote:

> On October 26, 2019 9:34:58 AM UTC, Behrang Saeedzadeh <
> behrangsa@gmail.com> wrote:
> >From Tomcat Embedded Core 9.0.26:
> >
> >@Override
> >protected void doClose() {
> >   if (log.isDebugEnabled()) {
> >     log.debug("Calling [" + getEndpoint() + "].closeSocket([" + this +
> >"])", new Exception());
> >   }
> >
> >Which will log something like:
> >
> >DEBUG [http-nio-8080-exec-2]
> >    org.apache.tomcat.util.net.NioEndpoint
> >        Calling [org.apache.tomcat.util.net.NioEndpoint@654c1a54].
> >closeSocket([org.apache.tomcat.util.net.NioEndpoint$
> >NioSocketWrapper@39e9d240:org.apache.tomcat.util.net.NioChannel@78019ed5
> >:java.nio.channels.SocketChannel[connected local=/127.0.0.1:8080
> >remote=/127.0.0.1:39988]])
> >
> >java.lang.Exception: null
> >at
> >org.apache.tomcat.util.net
> .NioEndpoint$NioSocketWrapper.doClose(NioEndpoint.java:1165)
> >[tomcat-embed-core-9.0.26.jar:9.0.26]
> >at
> >org.apache.tomcat.util.net
> .SocketWrapperBase.close(SocketWrapperBase.java:394)
> >[tomcat-embed-core-9.0.26.jar:9.0.26]
> >   at org.apache.tomcat.util.net.NioEndpoint$Poller.
> >cancelledKey(NioEndpoint.java:667)
> >[tomcat-embed-core-9.0.26.jar:9.0.26]
> >at
> >org.apache.tomcat.util.net
> .NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1592)
> >[tomcat-embed-core-9.0.26.jar:9.0.26]
> >at
> >org.apache.tomcat.util.net
> .SocketProcessorBase.run(SocketProcessorBase.java:49)
> >[tomcat-embed-core-9.0.26.jar:9.0.26]
> >at
>
> >java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> >[na:1.8.0_212]
> >at
>
> >java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> >[na:1.8.0_212]
> >at
>
> >org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> >[tomcat-embed-core-9.0.26.jar:9.0.26]
> >   at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]
> >
> >To print the stack trace next to the message? Why not only print the
> >stack
> >trace next to the log message using
> >org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace for
> >example? The presence of the `java.lang.Exception: null` in the logs is
> >a
> >bit misleading and confusing.
> >
> >Best regards,
> >Behrang Saeedzadeh
> >blog.behrang.org
>
> This is a repost of a message to the users@ list. It would have been
> better to wait a little longer for a reply there rather than repeating.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

Re: What's the purpose of this exception?

Posted by Mark Thomas <ma...@homeinbox.net>.
On October 26, 2019 9:34:58 AM UTC, Behrang Saeedzadeh <be...@gmail.com> wrote:
>From Tomcat Embedded Core 9.0.26:
>
>@Override
>protected void doClose() {
>   if (log.isDebugEnabled()) {
>     log.debug("Calling [" + getEndpoint() + "].closeSocket([" + this +
>"])", new Exception());
>   }
>
>Which will log something like:
>
>DEBUG [http-nio-8080-exec-2]
>    org.apache.tomcat.util.net.NioEndpoint
>        Calling [org.apache.tomcat.util.net.NioEndpoint@654c1a54].
>closeSocket([org.apache.tomcat.util.net.NioEndpoint$
>NioSocketWrapper@39e9d240:org.apache.tomcat.util.net.NioChannel@78019ed5
>:java.nio.channels.SocketChannel[connected local=/127.0.0.1:8080
>remote=/127.0.0.1:39988]])
>
>java.lang.Exception: null
>at
>org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doClose(NioEndpoint.java:1165)
>[tomcat-embed-core-9.0.26.jar:9.0.26]
>at
>org.apache.tomcat.util.net.SocketWrapperBase.close(SocketWrapperBase.java:394)
>[tomcat-embed-core-9.0.26.jar:9.0.26]
>   at org.apache.tomcat.util.net.NioEndpoint$Poller.
>cancelledKey(NioEndpoint.java:667)
>[tomcat-embed-core-9.0.26.jar:9.0.26]
>at
>org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1592)
>[tomcat-embed-core-9.0.26.jar:9.0.26]
>at
>org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
>[tomcat-embed-core-9.0.26.jar:9.0.26]
>at
>java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>[na:1.8.0_212]
>at
>java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>[na:1.8.0_212]
>at
>org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>[tomcat-embed-core-9.0.26.jar:9.0.26]
>   at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]
>
>To print the stack trace next to the message? Why not only print the
>stack
>trace next to the log message using
>org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace for
>example? The presence of the `java.lang.Exception: null` in the logs is
>a
>bit misleading and confusing.
>
>Best regards,
>Behrang Saeedzadeh
>blog.behrang.org

This is a repost of a message to the users@ list. It would have been better to wait a little longer for a reply there rather than repeating.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org