I've managed to find a solution that works. The info I found has me using
the "log4j-jul" bridge (and excluding spring-boot-starter-logging from
spring-boot-starter-web), which redirects from jul to log4j, which
effectively redirects to logback, which allows me to configure loggers in
the same place as my other loggers, in the logback.xml file. I haven't yet
verified this with the Tomcat startup error I was looking at (that was
apparently resolved in some other way), but I've verified that I can see
other log messages from StandardContext, so it's pretty likely this will
work.

On Sat, Apr 19, 2025, 11:49 AM KARR, DAVID <dk0...@att.com> wrote:

> This is an issue I've tried to pursue multiple times in the past, and each
> time I've given up and used an awkward solution that won't work in the
> current situation I'm seeing this. I thought perhaps I had asked it here
> before, but I don't see it in the archives.
>
> We have a couple hundred Java SpringBoot services, most of them using
> SpringBoot 3.2.5. Internally, it is using Tomcat through the
> "tomcat-embed-core" artifact, version 10.1.30.
>
> Every once in a while, I run into a problem where the service startup
> fails with some variation of this:
>
>     WebServerException: Unable to start embedded Tomcat
>
> The stacktrace provided in this case has no stack entries in application
> code. It provides no clue of what actually went wrong. Whenever I run into
> this, if I can run the service on my desktop, I set breakpoints in the
> StandardContext class wherever it sets "ok" to false. That always leads to
> the solution. It almost always points to a conflict with dependencies, but
> knowing that fact doesn't help me until I know what the conflict is.
>
> I really shouldn't have to do this. I can clearly see in the
> StandardContext class that it tries to log the exception message (usually a
> "MultiException" or something like that). Ideally, I should just be able to
> configure the logging for tomcat-embed-core to make it print the exception
> details. Several times I have struggled to make this work, and I've never
> been able to get it working. Tomcat uses java.util.logging, but it seems to
> have some variations that seemingly make it more difficult to configure.
> I've tried variations with a "logging.properties" file, but it never seems
> to make any difference. I've seen some posts that try to address this, but
> I've never found a complete solution for getting this working in a
> SpringBoot application.
>
> In the latest instance, I'm seeing this happen in an environment I can't
> run the debugger in, so I have no way to diagnose this.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to