You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2022/04/19 18:01:35 UTC

[Bug 66018] New: tomcat8.exe and tomcat9.exe when creating a service via command line requires --LogPath

https://bz.apache.org/bugzilla/show_bug.cgi?id=66018

            Bug ID: 66018
           Summary: tomcat8.exe and tomcat9.exe when creating a service
                    via command line requires --LogPath
           Product: Tomcat 9
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: safwat.ismail@jpmorgan.com
  Target Milestone: -----

Created attachment 38252
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=38252&action=edit
side-by-side comparison between services created with and without --LogPath

Prior to vresions 8.5.78 & 9.0.62 we ran an installation script to create
catalinabase services without passing --LogPath parameter. In the above
mentioned versions if omitted --LogPath from the command string, the service
does not pick up any Java settings.


#region Create Tomcat Service
# Copying tomcat8/w.exe to reflect service name"
$tcexe="$ServiceName.exe"
$tcwexe="$ServiceName"+"W.exe"
Copy-Item $tchome\bin\tomcat8.exe -Destination $tchome\bin\$tcexe -Force
Copy-Item $tchome\bin\tomcat8w.exe -Destination $tchome\bin\$tcwexe -Force

#Store command for creating a Tomcat service
Previous code:
$servicecommandstring = "$tchome\bin\$tcexe //IS//$ServiceName --Install
`"$tchome\bin\$tcexe`" --Description `"catalinabase$CatbaseNumber`" --Startup
auto --JavaHome `"$javahome`" --Jvm `"$javaruntimelib`"  --JvmMs 512 --JvmMx
1024 --JvmOptions
`"-Xrs;-Dcatalina.home=$tchome;-Dcatalina.base=$catbase;-Djava.io.tmpdir=$catbase\temp;-Djava.security.manager;-Djava.security.policy=$catbase\conf\catalina.policy;-Duser.timezone=UTC;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=$catbase\conf\logging.properties`"
--StartMode jvm --StopMode jvm --StartClass
`"org.apache.catalina.startup.Bootstrap`" --StopClass
`"org.apache.catalina.startup.Bootstrap`" --StartParams start --StopParams stop
--Classpath `"$tchome\bin\bootstrap.jar;$tchome\bin\tomcat-juli.jar`""




New Code: LogPath had to specified
$servicecommandstring = -Join ("$tchome\bin\$tcexe //IS//$ServiceName",
" --Install `"$tchome\bin\$tcexe`"",
" --Description `"catalinabase$CatbaseNumber`"",
" --Startup auto",
" --LogPath `"$catbase\logs`"",
" --JavaHome `"$javahome`"",
" --Jvm `"$javaruntimelib`"",
" --JvmMs 512",
" --JvmMx 1024",
" --JvmOptions
`"-Xrs;-Dcatalina.home=$tchome;-Dcatalina.base=$catbase;-Djava.io.tmpdir=$catbase\temp;-Duser.timezone=UTC;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=$catbase\conf\logging.properties`"",
" --StartMode jvm",
" --StopMode jvm",
" --StartClass `"org.apache.catalina.startup.Bootstrap`"",
" --StopClass `"org.apache.catalina.startup.Bootstrap`"",
" --StartParams start",
" --StopParams stop",
" --Classpath `"$tchome\bin\bootstrap.jar;$tchome\bin\tomcat-juli.jar`""
)
#Convert the string to a scriptblock object

[scriptblock]$servicecommand = [scriptblock]::Create($servicecommandstring)

#Run the command.
Invoke-Command -ScriptBlock $servicecommand

Please let us know if this is indeed a requirement going forward as this
information normally get passed in the --JvmOption section pointing to location
of the conf\logging.properties file

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66018] tomcat8.exe and tomcat9.exe when creating a service via command line requires --LogPath

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66018

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX
                 OS|                            |All

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
This has always been an expectation but it hasn't always been enforced.

The change of default service user in Daemon 1.2.0 from LocalSystem to
LocalService means that the default log path is no longer valid.

A change in 1.3.0 means that this now triggers an error during service
configuration but the error message gets lost. The expectation is that Daemon
1.3.1 will address this by writing an error message to stdout and performing
appropriate clean-up.

The workaround is to ensure that the configured (or default) user has
read/write access to the configured (or default) log path - which is what has
always been expected.

Note the location of the Daemon logs is configured separately from the location
of Tomcat log files - even if they use the same directory.

Resolving as WONTFIX as this will get addressed in Commons Daemon.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org