I write a flex + java application using the blazeds framework. when i write log files in my java classes the default path is the java path on the server. I want it to be my application at the tomcat/webapps/application direct开发者_StackOverflowory when i write it hard-coded it failed (maybe bacause of permissions) but, i want it to be general (not hard-coded) so, what do i need to change in my java code in order to write files in my webapps directory? maybe it just an xml configuration? what do i need to do? thank you!
Ok. I need to use this method: System.getProperty("catalina.base")
OK, so you've figured out how to do it.
But I'd like to suggest to you that it is a better idea to put log files in $CATALINA_HOME/logs
. The problem with putting log files in $CATALINA_HOME/webapps/yourApp
is that they are liable to be clobbered if you redeploy your WAR file.
also easy cheezy on unix is to put a symlink in your webapps/application directory to the log directory and add log to the url.
精彩评论