On Tue, Oct 7, 2008 at 2:29 PM, Byron Foster <[EMAIL PROTECTED]> wrote: > Mark Fenbers wrote: >> >> Thanks! Your info was quite helpful and I was able to read in the >> file (finally!) using Velocity.init() -- as you show below, but when >> I used Velocity.setProperty() to set the "runtime.log" as you have >> shown below, it gets ignored. > > If you use setProperty() make sure you do it AFTER the init(), because init > will wipe out any previous setProperties(), this may be the problem.
no, once any of the init() methods are called, the log system is initialized and further setProperty() calls are ignored. So, if you are using init(pathToPropsFile), then any properties set in that file override previous properties set and that's it. do your setProperty calls before init(). >> If I remove the runtime.log entry in >> the properties file, then the default log is used instead >> (./velocity.log). > > I don't follow here because ./velocity.log is the default log, you seem to > refer to a different default log. > >> What I wish is to use a different velocity log >> file for each user (as different users will use separate instances of >> my software concurrently). My software is a standalone GUI >> application written in Java 5, not a web app. How can I specify a >> log file name (determined at run-time) if the setProperty() method >> does not work?? if users have separate JVMs, then it you can keep using the Velocity singleton. if they are sharing a JVM, then you will have to use VelocityEngine. personally, i recommend avoiding the singleton anyway, unless you really have some reason to need it. > Sounds like your intent is to set runtime.log each time you process a > velocity template for a given user. Someone more familiar with the Velocity > log system could provide more info, but I believe that this will mean > Velocity will need to be re-initialized for each log switch, if this even > works. If efficiency is an issue you probably don't want to use this > solution, but maybe create a custom Velocity LogChute: > > http://velocity.apache.org/engine/releases/velocity-1.5/developer-guide.html#simpleexampleofacustomlogger > > Or maybe a logging package like Log4J or the java logging facility has an > appender that does what you need. if you use the regular jar, rather then the velocity-dep jar, and you leave out the LogKit dependency classes, then Velocity will automatically use Java 5's logger facilities. Those are easier to control and well documented. Likewise, if you leave LogKit out and add Log4j to your classpath, then Velocity will automatically use that. The same is true of Commons-Logging. The order of preference that Velocity uses by default is: LogKit Log4j CommonsLogging Servlet api Java 5 Logger System.out/err > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
