This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
     new 5372a7c  Fix BZ 64430. Add support for CATALINA_OUT_CMD Patch by 
Harald Dunkel.
5372a7c is described below

commit 5372a7c3c1e48ddbb4d5b424bc4bc68a70132225
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 28fa29a..013de4f 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
@@ -459,7 +467,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 5b5d83d..428370a 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -91,6 +91,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

Reply via email to