In case anyone is interested: I think I finally managed to resolve this. The problem in my case was with when running the Java process via https://github.com/nicoulaj/rainbow, which is useful for colorizing the log output based on some user-defined patterns. (I use this to colorize WARN, ERROR and INFO logs with different colors which makes them much more readable to me.) When I press Ctrl-C in this case, the stdout (which is likely a pipe or something else) is probably closed, so Logback has nowhere to write its logs => the thread in our application hangs, blocking shutdown. The workaround for me was to use an approach similar to what Ralph Goers suggested; log to a file instead. To still get reasonable Ctrl-C semantics and be able to shutdown the Java app easily, I used a little trick to send the log tailing to the background and run Java in the foreground: alias run_my_app='(pkill -f 'the_log_file.log' || && cd ~/git/myapp && (tail -n0 -f /foo/bar/the_log_file.log | rainbow -f catalina &) && ./dev/scripts/run_my_app.sh' It's not super-pretty but it works for me. I have shutdown the Java process now at least 5 times since making this change, and no hangs so far. In addition, I now see more of the logs being emitted by the application during shutdown which previously silently discarded...  Ceki Gülcü - feel free to close this ticket now. Thanks for your help. |