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").


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).


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).

Best regards,
Konstantin Kolinko

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

Reply via email to