This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push: new 5dd4733 Fix BZ 64430. Add support for CATALINA_OUT_CMD Patch by Harald Dunkel. 5dd4733 is described below commit 5dd4733ea0d5a6281fc9d51c85fdb69b56336eed Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu May 28 22:01:13 2020 +0100 Fix BZ 64430. Add support for CATALINA_OUT_CMD Patch by Harald Dunkel. --- bin/catalina.sh | 23 ++++++++++++++++++++++- webapps/docs/changelog.xml | 5 +++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/bin/catalina.sh b/bin/catalina.sh index 0ee6595..7823d5e 100755 --- a/bin/catalina.sh +++ b/bin/catalina.sh @@ -36,6 +36,14 @@ # will be redirected. # Default is $CATALINA_BASE/logs/catalina.out # +# CATALINA_OUT_CMD (Optional) Command which will be executed and receive +# as its stdin the stdout and stderr from the Tomcat java +# process. If CATALINA_OUT_CMD is set, the value of +# CATALINA_OUT will be used as a named pipe. +# No default. +# Example (all one line) +# CATALINA_OUT_CMD="/usr/bin/rotatelogs -f $CATALINA_BASE/logs/catalina.out.%Y-%m-%d.log 86400" +# # CATALINA_OPTS (Optional) Java runtime options used when the "start", # "run" or "debug" command is executed. # Include here and not in JAVA_OPTS all options, that should @@ -450,7 +458,20 @@ elif [ "$1" = "start" ] ; then fi shift - touch "$CATALINA_OUT" + if [ -z "$CATALINA_OUT_CMD" ] ; then + touch "$CATALINA_OUT" + else + if [ ! -e "$CATALINA_OUT" ]; then + if ! mkfifo "$CATALINA_OUT"; then + echo "cannot create named pipe $CATALINA_OUT. Start aborted." + exit 1 + fi + elif [ ! -p "$CATALINA_OUT" ]; then + echo "$CATALINA_OUT exists and is not a named pipe. Start aborted." + exit 1 + fi + $CATALINA_OUT_CMD <"$CATALINA_OUT" & + fi if [ "$1" = "-security" ] ; then if [ $have_tty -eq 1 ]; then echo "Using Security Manager" diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 32ea0dd..c4b0e83 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -119,6 +119,11 @@ Improve the quality and expand the coverage of the French translations provided with Apache Tomcat. (remm) </add> + <add> + <bug>64430</bug>: Add support for the <code>CATALINA_OUT_CMD</code> + environment variable that defines a command to which captured stdout and + stderr will be redirected. Patch provided by Harald Dunkel. (markt) + </add> </changelog> </subsection> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org