You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Serge Knystautas <se...@lokitech.com> on 2003/02/11 16:59:47 UTC

Logging instance issues

I'm not sure if anybody has seen this or come across this, and my 
results are far from conclusive but...

I'm using Velocity for a rendering system, and from first load testing 
it seemed a VelocityEngine was not threadsafe, at least not the way we 
were using it (maybe was recursive calls, wasn't sure).  So I took 
Commons' Pool implementation and pool a bunch of VelocityEngines. 
Everything seems to be working quite well.

Recently though I started noticing we were getting "Too Many Open File 
Handles" errors, so I did some checking on how the logging worked.  What 
I found was bad instance handling management for both Avalon and Log4j 
handlers.

For each instance of VelocityEngine that was created, AvalonLogger would 
reopen the same log file without appending, truncating the file, and I 
believe stranding the other logger instance, leaving the handles open. 
My guess is when the VelocityEngine was finalized, the logger was never 
finalized.

Somewhat better behavior (in a sense) was Log4J.  All messages would go 
to a single logfile, but for each new instance created, an extra copy 
was printed to this file.  So if I had 4 engines in memory, and one of 
them made a log call, that line would appear 4 times in the log file. 
Even worse though was if 2 of those original engines were disposed, I 
would still see a log entry appear 4 times in the file.

In either case, as VelocityEngines were created and disposed in the 
pool, logging would progressively get uglier.  Maybe I'm not disposing 
of the engines correctly, but I don't see a dispose or shutdown method 
on them.

Finally, I couldn't find in the documentation (javadocs or various 
user/dev guides) instructions on how to set the log level.  When this 
system is in production, I don't care about "info" level messages 
anymore.  I saw how to turn on/off stack traces, but not the messages 
altogether.

In the short-term I've just moved to the Null logger, since the log 
files for the moment are not the most important things.  But still, it 
would be good to have some basic logging that could handle multiple 
instances.  Any suggestions?

--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org