On 23.03.2022 11:45, Thomas Hoffmann (Speed4Trade GmbH) wrote: >> -----Ursprüngliche Nachricht----- >> Von: Rony G. Flatscher (Apache) <r...@apache.org> >> Gesendet: Mittwoch, 23. März 2022 11:34 >> An: users@tomcat.apache.org >> Betreff: Re: Maybe a stupid (Windows related) question >> >> On 22.03.2022 20:18, Christopher Schultz wrote: >> >> ... cut ... >> >>> You still can't really "background" the process the way you can on >>> *nix. Sure, you can get your command-prompt back, but if you kill >>> cmd.exe, so does your child process die. And if you log out, that process >> dies as well. >> >> The problem is different: redirecting stderr and stdout does not redirect in >> this scenario (employing %CATALINA_HOME%\bin\startup.bat), rather >> output statements to stderr >> (System.err.println(...)) and stdout (System.out.println(...)) gets still >> displayed in the Tomcat window. >> >> This involves (at least in my experiments) editing bin\startup.bat and/or >> bin\catalina.bat which should not be necessary if understanding Tomcat's >> philsophy correctly. If adjustments are necessary it is advised to supply a >> "bin\setup.bat" script to do so. >> >> So what I would be looking for is either a configuration change or an >> environment variable to set which allows redirecting stdout and stderr to >> appropriate log files as is done with the service version by default. >> >>> Using the Windows Service is really the best way to do it on Windows. >> The use case is testing Tomcat 10 in various ways, including running it in >> debug mode and attaching via IntelliJ for inspection. >> >> ---rony >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org > The bat-file uses the line: > call "%EXECUTABLE%" start %CMD_LINE_ARGS% > > At this place you might be able to redirect the output: > call "%EXECUTABLE%" start %CMD_LINE_ARGS% > out.log > > You could also try to pass the redirect param to the argument of startup.bat, > don’t know if this works, e.g. > startup.bat " > out.log"
startup.bat uses start to run catalina.bat in a new cmd window with: call "%EXECUTABLE%" start %CMD_LINE_ARGS% catalina.bat then starts Tomcat as: %_EXECJAVA% %CATALINA_LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% 2>&1 1> D:\orx.debug\work_rii_tomcat\test.log This does not work. ---rony