Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 29504 invoked from network); 9 May 2007 16:26:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 May 2007 16:26:39 -0000 Received: (qmail 30026 invoked by uid 500); 9 May 2007 16:26:32 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 29996 invoked by uid 500); 9 May 2007 16:26:32 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 29985 invoked by uid 99); 9 May 2007 16:26:32 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2007 09:26:32 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [64.135.210.100] (HELO king.andy-t.org) (64.135.210.100) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2007 09:26:24 -0700 Received: from king.andy-t.org (localhost [127.0.0.1]) by king.andy-t.org (8.13.6/8.13.3) with ESMTP id l49GQ21e010864 for ; Wed, 9 May 2007 11:26:02 -0500 Received: from localhost (andyt@localhost) by king.andy-t.org (8.13.6/8.13.3/Submit) with ESMTP id l49GQ1Gt010860 for ; Wed, 9 May 2007 11:26:01 -0500 X-Authentication-Warning: king.andy-t.org: andyt owned process doing -bs Date: Wed, 9 May 2007 11:26:01 -0500 (CDT) From: Andy X-X-Sender: andyt@king.andy-t.org To: Tomcat Users List Subject: RE: Runaway catalina.out logging In-Reply-To: <360A1674FFC73B42BFD657060941DBF30BE87286@FG200201EVS.ftb.ca.gov> Message-ID: References: <360A1674FFC73B42BFD657060941DBF30BE87286@FG200201EVS.ftb.ca.go v> Importance: normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=us-ascii X-Virus-Checked: Checked by ClamAV on apache.org You are right. To generalize this: It is all a matter of shell precedences. Pipe (|) has a higher precedence than angle redirect (>) which is why redirect is needed on both sides. However, grouping two commands with parentheses overrides this behavior, again because parentheses have even higher precedence. I guess I have worded it very awkwardly, so here is a set of examples: # Errors from two commands, both sent to stderr bash-2.05b$ ls /aaa | sort -q sort: invalid option -- q Try `sort --help' for more information. ls: /aaa: No such file or directory # Error from the first command suppressed, error from the second shows bash-2.05b$ ls /aaa >/dev/null 2>&1 | sort -q sort: invalid option -- q Try `sort --help' for more information. # Error from the first command shows, error from the second suppressed bash-2.05b$ ls /aaa | sort -q >/dev/null 2>&1 ls: /aaa: No such file or directory # Errors from both commands suppressed independently bash-2.05b$ ls /aaa >/dev/null 2>&1 | sort -q >/dev/null 2>&1 # Errors from both commands suppressed together bash-2.05b$ (ls /aaa | sort -q) >/dev/null 2>&1 Regards, Andy On Wed, 9 May 2007, Fargusson.Alan wrote: > At the risk of over explaining, this is one of those slightly tricky areas of shell syntax. > > The general form of the command below would be something like: > ls -l | pr > Out > > Now there are two commands that might generate errors to the terminal. So you do this: > ls -l | pr > Out 2>&1 > > Now you might still see errors output to the terminal. The above redirects the output of the pr command, but not the ls command. So you have to do this: > ls -l 2>&1 | pr > Out 2>&1 > > The first 2>&1 redirects the stderr of the ls command into the pipe. The second 2>&1 redirects the output of pr to the file named Out. > > The syntax for redirecting stderr to a pipe is a little odd, but in order to get this right it needs to be something like this. > > -----Original Message----- > From: Andy [mailto:tom1cat@andy-t.org] > Sent: Tuesday, May 08, 2007 7:11 PM > To: Tomcat Users List > Subject: Re: Runaway catalina.out logging > > > Filip, > > This works, thanks, although I am still not sure why the original failed. > Too many players in a single command... > > Regards, > > Andy > > On Wed, 9 May 2007, Filip Hanik - Dev Lists wrote: > >> change >> | /u00/tomcat/bin/logger "$CATALINA_BASE"/logs/catalina 2>&1 & >> to >> 2>&1 | /u00/tomcat/bin/logger "$CATALINA_BASE"/logs/catalina 2>&1 & >> >> ie, redirect stderr into stdout before passing it into the logger >> >> Filip >> >> Andy wrote: >>> This is a correction of the Subject: which I failed to set properly in my >>> original message. Sorry... >>> >>> Hi there, >>> >>> We have recently switched to tomcat-5.5, on SuSE 9.3, and I ran into a >>> strange problem that was not there before. >>> >>> I am using a custom script from catalina.out rotation. It works much the >>> same way as cronolog, except it is much simpler and does more (if anyone >>> wants to see/use it, let me know ;) ). The script is invoked using the >>> same approach, from catalina.sh: >>> >>> I replace >>> >>> >> "$CATALINA_BASE"/logs/catalina.out 2>&1 & >>> >>> with >>> >>> | /u00/tomcat/bin/logger "$CATALINA_BASE"/logs/catalina 2>&1 & >>> >>> This used to work perfectly. But with ver.5.5, some startup and shutdown >>> messages "escape" to the terminal. The rest goes to the script as before. >>> It seems that for those messages, tomcat explicitly uses a file descriptor >>> that corresponds to the terminal, or some such thing. >>> >>> Anyone has an idea why this is happening, and how I can capture the >>> runaways? Any help would be greatly appreciated. >>> >>> Regards, >>> >>> Andy Tsouladze >>> >>> Escaping startup messages: >>> >>> May 8, 2007 5:45:41 PM org.apache.catalina.core.AprLifecycleListener >>> lifecycleEvent >>> INFO: The Apache Tomcat Native library which allows optimal performance in >>> production environments was not found on the java.library.path: >>> /usr/java/jre1.5.0_11/lib/amd64/server:/usr/java/jre1.5.0_11/lib/amd64:/usr/ >>> java/jre1.5.0_11/../lib/amd64 >>> May 8, 2007 5:45:41 PM org.apache.coyote.http11.Http11BaseProtocol init >>> INFO: Initializing Coyote HTTP/1.1 on http-8080 >>> May 8, 2007 5:45:42 PM org.apache.coyote.http11.Http11BaseProtocol init >>> INFO: Initializing Coyote HTTP/1.1 on http-8443 >>>> May 8, 2007 5:45:42 PM org.apache.catalina.startup.Catalina load >>> INFO: Initialization processed in 1776 ms >>> May 8, 2007 5:45:42 PM org.apache.catalina.core.StandardService start >>> INFO: Starting service Catalina >>> May 8, 2007 5:45:42 PM org.apache.catalina.core.StandardEngine start >>> INFO: Starting Servlet Engine: Apache Tomcat/5.5.17 >>> May 8, 2007 5:45:42 PM org.apache.catalina.core.StandardHost start >>> INFO: XML validation disabled >>> May 8, 2007 5:45:43 PM org.apache.catalina.core.StandardContext start >>> SEVERE: Error listenerStart >>> May 8, 2007 5:45:43 PM org.apache.catalina.core.StandardContext start >>> SEVERE: Context [/axis] startup failed due to previous errors >>> May 8, 2007 5:45:44 PM org.apache.coyote.http11.Http11BaseProtocol start >>> INFO: Starting Coyote HTTP/1.1 on http-8080 >>> May 8, 2007 5:45:44 PM org.apache.coyote.http11.Http11BaseProtocol start >>> INFO: Starting Coyote HTTP/1.1 on http-8443 >>> May 8, 2007 5:45:44 PM org.apache.jk.common.ChannelSocket init >>> INFO: JK: ajp13 listening on /0.0.0.0:8009 >>> May 8, 2007 5:45:44 PM org.apache.jk.server.JkMain start >>> INFO: Jk running ID=0 time=0/82 config=null >>> May 8, 2007 5:45:44 PM org.apache.catalina.storeconfig.StoreLoader load >>> INFO: Find registry server-registry.xml at classpath resource >>> May 8, 2007 5:45:44 PM org.apache.catalina.startup.Catalina start >>> INFO: Server startup in 2181 ms >>> >>> >>> Escaping shutdown messages: >>> >>> >>> May 8, 2007 5:47:25 PM org.apache.coyote.http11.Http11BaseProtocol pause >>> INFO: Pausing Coyote HTTP/1.1 on http-8080 >>> May 8, 2007 5:47:25 PM org.apache.coyote.http11.Http11BaseProtocol pause >>> INFO: Pausing Coyote HTTP/1.1 on http-8443 >>> csapp02:/u00/jakarta/bin # May 8, 2007 5:47:26 PM >>> org.apache.catalina.core.StandardService stop >>> INFO: Stopping service Catalina >>> May 8, 2007 5:47:26 PM org.apache.coyote.http11.Http11BaseProtocol destroy >>> INFO: Stopping Coyote HTTP/1.1 on http-8080 >>> May 8, 2007 5:47:26 PM org.apache.coyote.http11.Http11BaseProtocol destroy >>> INFO: Stopping Coyote HTTP/1.1 on http-8443 >>> May 8, 2007 5:47:26 PM org.apache.catalina.core.AprLifecycleListener >>> lifecycleEvent >>> INFO: Failed shutdown of Apache Portable Runtime >>> >>> --------------------------------------------------------------------- >>> To start a new topic, e-mail: users@tomcat.apache.org >>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >>> For additional commands, e-mail: users-help@tomcat.apache.org >>> >>> >>> >> >> >> --------------------------------------------------------------------- >> To start a new topic, e-mail: users@tomcat.apache.org >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >> For additional commands, e-mail: users-help@tomcat.apache.org >> > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org