[Tomcat Wiki] Update of HowTo by ChristopherSchultz

2015-01-21 Thread Apache Wiki
Dear Wiki user,

You have subscribed to a wiki page or wiki category on Tomcat Wiki for change 
notification.

The HowTo page has been changed by ChristopherSchultz:
https://wiki.apache.org/tomcat/HowTo?action=diffrev1=141rev2=142

  
  == How to create native launchers for Tomcat ==
  See [[TomcatCreateNativeLaunchers]] 
+ 
+ == How do I rotate catalina.out? ==
+ 
+ Honestly, the first question is why are you rotating catalina.out? Tomcat 
logs very little to catalina.out so the usual culprit is web applications that 
stupidly send output to System.out or System.err. If that's the case, what you 
ought to do is set swallowOutput=true on the application's Context 
configuration. That will send the output to a file configured (default) by 
conf/logging.properties. Once you've done that, get the application fixed to 
use a real logger, or at least use ServletContext.log().
+ 
+ If you've decided that you still absolutely positively need to rotate 
catalina.out, there is something that you have to understand: catalina.out is 
created by your shell's output redirection, just like when you type ls -l  
dir_listing.txt. So rotating the file needs to be done carefully.
+ 
+ You can't just re-name the file or you'll find that Tomcat will continue 
logging to the file under the new name. You also can't delete catalina.out and 
re-create it, or you'll never get anything logged to catalina.out after that, 
unless you restart Tomcat.
+ 
+ There are really only two ways to properly rotate catalina.out, and they both 
have downsides.
+ 
+ === Rotate catalina.out using logrotate (or similar) ===
+ 
+ To use a tool like 
[[http://linuxcommand.org/man_pages/logrotate8.html|logrotate]], you'll want to 
use the copytruncate configuration option. This will copy catalina.out to 
another file (like catalina.out.[datestamp]) and then truncates catalina.out to 
zero-bytes. There is a major downside to this if catalina.out is seeing a lot 
of action: some log messages written to the log file during the copy/truncate 
procedure may be lost.
+ 
+ === Rotate catalina.out using rotatelogs or chronolog (or similar) ===
+ 
+ To use a tool like Apache httpd's 
[[http://httpd.apache.org/docs/2.4/programs/rotatelogs.html|rotatelogs]] or 
[[http://linux.die.net/man/1/cronolog|chronolog]], you'll have to modify 
Tomcat's catalina.sh (or catalina.bat) script to change the output redirection 
from a redirect to a pipe. The existing code in catalina.sh looks like this:
+ 
+ {{{
+ eval \$_RUNJAVA\ \$LOGGING_CONFIG\ $LOGGING_MANAGER $JAVA_OPTS 
$CATALINA_OPTS \
+   -Djava.endorsed.dirs=\$JAVA_ENDORSED_DIRS\ -classpath 
\$CLASSPATH\ \
+   -Djava.security.manager \
+   -Djava.security.policy==\$CATALINA_BASE/conf/catalina.policy\ \
+   -Dcatalina.base=\$CATALINA_BASE\ \
+   -Dcatalina.home=\$CATALINA_HOME\ \
+   -Djava.io.tmpdir=\$CATALINA_TMPDIR\ \
+   org.apache.catalina.startup.Bootstrap $@ start \
+$CATALINA_OUT 21 
+ }}}
+ 
+ You'll need to change that to something which looks more like this:
+ 
+ {{{
+ eval \$_RUNJAVA\ \$LOGGING_CONFIG\ $LOGGING_MANAGER $JAVA_OPTS 
$CATALINA_OPTS \
+   -Djava.endorsed.dirs=\$JAVA_ENDORSED_DIRS\ -classpath 
\$CLASSPATH\ \
+   -Djava.security.manager \
+   -Djava.security.policy==\$CATALINA_BASE/conf/catalina.policy\ \
+   -Dcatalina.base=\$CATALINA_BASE\ \
+   -Dcatalina.home=\$CATALINA_HOME\ \
+   -Djava.io.tmpdir=\$CATALINA_TMPDIR\ \
+   org.apache.catalina.startup.Bootstrap $@ start \
+   | $PATH_TO_CHRONOLOG $CATALINA_BASE/logs/catalina.out.%Y-%m-%d
+ }}}
+ 
+ This will be somewhat similar for catalina.bat, but the actual launch command 
will look different.
+ 
+ Also note that there are currently two places in catalina.sh (and 
catalina.bat) where Tomcat is launched, depending upon whether you are using a 
security manager or not. You should read the whole catalina.sh (or 
catalina.bat) file to make sure you have handled every case where Tomcat is 
launched.
  
  = Configuration =
  == How do I set up multiple sites sharing the same war application/war file? 
==

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Tomcat Wiki] Update of HowTo by ChristopherSchultz

2012-11-27 Thread Apache Wiki
Dear Wiki user,

You have subscribed to a wiki page or wiki category on Tomcat Wiki for change 
notification.

The HowTo page has been changed by ChristopherSchultz:
http://wiki.apache.org/tomcat/HowTo?action=diffrev1=117rev2=118

  
  This will produce a thread dump on standard output, but may not be possible 
to capture to a file.
  
+ == How do I read a Java thread dump ? ==
+ 
+ Java thread dumps are just text files, so you can read them with any text 
editor. There are some tools that can make your life easier, especially if you 
need to look at more than one thread dump at once.
+ 
+ One such tool is the Thread Dump Viewer (TDV), which you can find here: 
http://tdv.sourceforge.net/. It is a bit old (last release: 2007) but it can be 
somewhat helpful.
  
  == How do I obtain a heap dump? ==
  

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Tomcat Wiki] Update of HowTo by ChristopherSchultz

2011-08-11 Thread Apache Wiki
Dear Wiki user,

You have subscribed to a wiki page or wiki category on Tomcat Wiki for change 
notification.

The HowTo page has been changed by ChristopherSchultz:
http://wiki.apache.org/tomcat/HowTo?action=diffrev1=113rev2=114

  
  To send a SIGQUIT, use ''kill -3 pid'' from the command line.
  
+ === If you are running on Microsoft Windows ===
+ You can try to use SendSignal, developed specifically for this purpose. Make 
sure you read the comments for certain sitautions (e.g. running as a service, 
RDP connections, etc.). 
http://www.latenighthacking.com/projects/2003/sendSignal/
+ 
+ 
  === If you are running Tomcat as a service on Microsoft Windows ===
  Edit your service to add the //MS// option to the command line. This 
enabled the Monitor Service which puts an icon in the system tray while 
Tomcat is running. Right-clicking the Tomcat monitor in the system tray allows 
you to produce a thread dump in stdout.
  

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Tomcat Wiki] Update of HowTo by ChristopherSchultz

2010-01-13 Thread Apache Wiki
Dear Wiki user,

You have subscribed to a wiki page or wiki category on Tomcat Wiki for change 
notification.

The HowTo page has been changed by ChristopherSchultz.
The comment on this change is: Fixed spelling of priviledges. Added reference 
to jsvc to the section on running without root..
http://wiki.apache.org/tomcat/HowTo?action=diffrev1=82rev2=83

--

  
  Corrections and comments are most welcome!
  
- == How to run Tomcat without root priviledges? ==
+ == How to run Tomcat without root privileges? ==
+ 
+ The best way is to use jsvc, available as part of the 
[[http://commons.apache.org/daemon/jsvc.html|commons-daemon]] project.
+ 
+ 
+ 
- Is there a way to allow normal user(non-root) to start/stop the tomcat 
server. Tried assigning permision, did not work. Read thru some articles, 
stated that only root has permission to port below 1025.
+ Is there a way to allow normal user(non-root) to start/stop the tomcat 
server. Tried assigning permission, did not work. Read thru some articles, 
stated that only root has permission to port below 1025.
  How can i allow a non-root user to do so ? thks in adv. :)
  
  - malathi ranjit singh

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Tomcat Wiki] Update of HowTo by ChristopherSchultz

2009-06-22 Thread Apache Wiki
Dear Wiki user,

You have subscribed to a wiki page or wiki category on Tomcat Wiki for change 
notification.

The following page has been changed by ChristopherSchultz:
http://wiki.apache.org/tomcat/HowTo

--
  
  Note that this last method also implies that in order to make any change to 
any application, you will have to stop and restart Tomcat.
  
+ == How do I obtain a thread dump of my running webapp ? ==
+ 
+ You can only get a thread dump of the entire JVM, not just your webapp. This 
shouldn't be a big deal, but should be made clear: you are getting a dump of 
all JVM threads, not just those for your application, whatever that means.
+ 
+ Getting a thread dump depends a lot on your environment. Please choose the 
section below that matches your environment best. The more universal and 
convenient options are presented first, while the more difficult ones or those 
for specific setups are provided later. Generally, you should start at the top 
of the list and work your way down until you find a technique that works for 
you.
+ 
+ === If you are running Sun JDK 1.6 or higher ===
+ 
+ Sun's JDK (not the JRE) ships with a program called ''jstack'' (or 
''jstack.exe'' on Microsoft Windows) which will give you a thread dump on 
standard output. Pipe the output into a file and you have your thread dump. You 
will need the process id (pid) of the process to dump. Use of the program 
''jps'' (''jps.exe'' on Microsoft Windows) can help you determine the pid of a 
specific Java process.
+ 
+ === If you are on *NIX running Sun JDK ===
+ 
+ Sun provides ''jstack'' on *nix systems from version 1.4 onward. See the 
above tip if you have such an environnment.
+ 
+ === If you are running on *NIX ===
+ 
+ Send a SIGQUIT to the process. The thread dump will be sent to stdout which 
is likely to be redirected to CATALINA_BASE/logs/catalina.out.
+ 
+ To send a SIGQUIT, use ''kill -3 pid'' from the command line.
+ 
+ === If you are running Tomcat as a service on Microsoft Windows ===
+ 
+ Edit your service to add the //MS// option to the command line. This 
enabled the Monitor Service which puts an icon in the system tray while 
Tomcat is running. Right-clicking the Tomcat monitor in the system tray allows 
you to produce a thread dump in stdout.
+ 
+ === If you have Tomcat running in a console ===
+ 
+ *NIX: Press CRTL-\
+ Microsoft Windows: press CRTL-BREAK
+ 
+ This will produce a thread dump on standard output, but may not be possible 
to capture to a file.
+ 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org