[ 
https://issues.apache.org/jira/browse/AMQ-2920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13763060#comment-13763060
 ] 

Marc Schöchlin commented on AMQ-2920:
-------------------------------------

I fully agree, this might be a real pain for debugging production problems.
Threaddumps can also be collected 

I suppressed all messages on STDOUT/STDERR in the implementation of the new 
init script because this logfile cannot be rotated by log4j.


I think it would be really useful to redirect STDOUT/STDERR to the activemq 
logfile.
As i can remember JBOSS also does this, probably the sourcecode might be useful 
for changing this.
Probably a redirected logger fails i.e in situations with memory problems - i 
don't know how jboss handles these types of problems.

Alternative way: 
 * Reconfigure log4j not to log regular log messages to STDOUT/STDERR
   (this logfile is not rotated, therefore only really essential/critical 
things should be logged in this file)
 * Modify sys-v init script to provide the possibility to log messages to a 
logfile specified in /etc/default/activemq or $HOME/.activemqrc
   (see appended patch)


{code}
$ LANG=C diff -u activemq.orig activemq
--- activemq.orig       2013-09-10 16:02:36.221780777 +0200
+++ activemq    2013-09-10 16:13:38.813794912 +0200
@@ -214,6 +214,10 @@
     ACTIVEMQ_KILL_MAXSECONDS=30
 fi
 
+# LOG STDERR/STDOUT to this file 
+# (be careful, because this logfile is not under logrotation)
+ACTIVEMQ_CONSOLE_LOG="/dev/null"
+
 ## END:DEFAULTCONFIG
 
 # ------------------------------------------------------------------------
@@ -393,6 +397,8 @@
    fi
    # Execute java binary
    if [ -n "$PIDFILE" ] && [ "$PIDFILE" != "stop" ];then
+
+      echo "INFO: redirecting activemq stderr/stdout to $ACTIVEMQ_CONSOLE_LOG"
       $DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
               -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \
               -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \
@@ -400,7 +406,7 @@
               -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \
               -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \
               $ACTIVEMQ_CYGWIN \
-              -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS 
>/dev/null 2>&1 &
+              -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS 
>$ACTIVEMQ_CONSOLE_LOG 2>&1 &
               RET=\"\$?\"; APID=\"\$!\";
               echo \$APID > $PIDFILE;
               echo \"INFO: pidfile created : '$PIDFILE' (pid '\$APID')\";exit 
\$RET" $DOIT_POSTFIX
@@ -691,4 +697,4 @@
     ;;
   *)
     invoke_task
-esac
\ No newline at end of file
+esac
{code}


                
> new ActiveMQ 5.4.0 sysv start script redirects process stdout and stderr to 
> /dev/null
> -------------------------------------------------------------------------------------
>
>                 Key: AMQ-2920
>                 URL: https://issues.apache.org/jira/browse/AMQ-2920
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.4.0
>            Reporter: Mats Henrikson
>            Assignee: Gary Tully
>             Fix For: 5.6.0
>
>
> It appears that the new sysV start/init script redirects all the process 
> output to /dev/null when starting the broker.
> This leads to pain and confusion, since you will not see any error output 
> when you have e.g. a non-compliant activemq.xml config file - the script just 
> completes successfully but your broker has not started. To see the output you 
> actually have to hack the init script to remove the /dev/null, or get the 
> script to output the command line so that you can run it by hand to get the 
> error output.
> The process output should probably be redirected to some log file in the data 
> directory.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to