-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Konstantin,

On 6/30/18 11:49 AM, Konstantin Kolinko wrote:
> 2018-06-30 12:55 GMT+03:00 Carl-Henrik Tjärnlund
> <kalle.tjarnl...@gmail.com>:
>> Hi! I'm in the process of upgrading from tomcat 8 to 9 and was
>> running into a probelm with velocity not beeing able to create
>> the default log file, ./velocity.log and after some
>> troubleshooting it seems it is trying to create it in the root of
>> the file system instead of the current working directory, which i
>> thought would be CATALINA_BASE.
>> 
>> I just did some test and logging in the webapp:
>> 
>> log.info("Working path: " + new File(".").getAbsolutePath());
>> 
>> would report "Working path:  /. And I could do a workaround by
>> creating /velocity.log manually and give the tomcat9 user
>> ownership.
> 
> Or you could do System.getProperty("user.dir").

Or put -Duser.dir=[whatever] in CATALINA_BASE/bin/setenv.sh

> Tomcat does not care what the current working directory is when
> you launch it.  All it cares is the value of system properties 
> "catalina.home" and "catalina.base".
> 
> (The well known environment variables CATALINA_HOME, CATALINA_BASE
> are used by catalina.sh/catalina.bat scripts to set those system 
> properties when launching Java process for Tomcat).

+1

Moreover, Tomcat does not alter the CWD from whatever process launched i
t.

> If your logging configuration supports substitution of environment 
> variables, use one of those variables explicitly, e.g. as 
> "${catalina.base}/logs" (see the default conf/logging.properties
> in Tomcat for an example).

This would be best. Relying on the CWD is a bad practice that will
lead to these kinds of problems.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAls33dEACgkQHPApP6U8
pFgKuQ/7BnyehnsnqDCrMuOZCsRnP/b24Iqpx5PHduknwCp8y1eweR+Yy5gnCTg4
BlNYabwKXdde5U+2IcE6CIxlOVKUDSaK7S0/QrrOy+QExSn5GKIlJ88F4OA5o4ow
6gkzegtMfN4FHfXUKWlCnu9x1Gpv2aAGong9tdLyoXtUo1klrjKim4NgDB7lpqNp
U8fjkkNGyAL55NlqAIaRKwCCq2EfkrgSYnbsO6KgwvOJozWMTU345WrYeUEEnNup
eTByANX1s5hyNsaCyViG12Ossa5kjWcDO2hfhki28z3HiXpay8MIQOgccD3PoWj8
2/oUYZzrc3zCqmKOcda+0bdI33oltSeMX0g+qGnZH05G17BhNC5KCOSf5/2n3mGS
iNpBVwA0bYbgY1S0rYeLukviyr+t8LCR1ccRzgm/ureNFLt09uDXEBy6vfSjGdtP
pMxUtjbBFWWY/jiTKGP4EULWjUODl9osmcAvQZAB9w22r0gyO8JJSijMjiericPH
dWdPcUhTsV0PyK7tw8jxcCX91XX2nUODVPjdxP6KIo95uRRX5ZSe6RFSMEP6AOfK
yrUg93gXC6ZIlJ0c0UCJJXSzb79AAy3FYkCHEnpXUyIaLPvuPiKGgScRvwhFciUh
peaC/7K2/1ICRZoEoye2QSmwY999F24mwqE6uHS+8LquTnpHGQU=
=AvVE
-----END PGP SIGNATURE-----

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

Reply via email to