Joe/Chris-- I use log4j in some of my apps, haven't had much trouble.
Are you using Velocity 1.5? Velocity's logging behavior was cleaned up substantially in the last release. The "velocity.log" file is generated by the Avalon logkit, it shouldn't appear if you use Log4J. Try removing "logkit.jar" from your classpath. One thing that causes problems is when random third-party libraries (cough - Axis2!) include a log4j.properties in their jar file. Since log4j looks for the first log4j.properties it can find, if it hits some other library's file first it will ignore the log4j for your main app. I solve this by either (A) manually initializing log4j in my app startup with the correct properties file or (B) just being careful that there's only one log4j.properties in my classpath. WILL On 7/17/07, Townson, Chris <[EMAIL PROTECTED]> wrote:
Hi Malcolm and Joe, I have to echo Joe's comments: Velocity's behaviour with log4j and Commons Logging is one of the things I find I find most irritating in general development terms (as everything else is so nice and simple and works fine on the whole). I have _never_ been able to get logging to work satisfactorily (admittedly, I gave up a while back and haven't tried again). Why a log4j.xml rather than properties? I always have log4j.properties at the root of the classpath: this gets routinely ignored by Velocity, I'm sorry to say. It's not too big a deal to me and can accept a separate log file, but it would be good if (like many other apps/frameworks; e.g. Spring) Velocity just transparently picked-up my log4j config and output to the same file as everything else. Chris > -----Original Message----- > From: Malcolm Edgar [mailto:[EMAIL PROTECTED] > Sent: 17 July 2007 14:13 > To: Velocity Users List > Subject: Re: Can't make it log with log4j > > I would recommend using the log4j.xml configuration file, and put it > somewhere up high in your class path. > > regards Malcolm Edgar > > On 7/17/07, Joe Kramer <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > I have hard time taming velocity log output. > > My webapp uses log4j globally. > > velocity.properties has the following: > > runtime.log.logsystem.class = > > org.apache.velocity.runtime.log.Log4JLogChute > > runtime.log.logsystem.log4j.category=velocity > > > > log4j.properties: > > log4j.rootCategory=INFO, LOGFILE > > log4j.appender.LOGFILE=org.apache.log4j.FileAppender > > ... > > log4j.velocity=WARN > > log4j.org.apache.velocity=WARN > > > > Regardless of above configuration, velocity creates it's own > > velocity.log and logs with some default settings. > > What is more strange, every message is velocity.log is > repeated 5 to 6 > > times! > > > > Can anyone point me the best practice to configure velocity > with log4j ? > > > > Thanks. > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > ******************************************************************************** DISCLAIMER: This e-mail is confidential and should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage mechanism. Neither Macmillan Publishers Limited nor any of its agents accept liability for any statements made which are clearly the sender's own and not expressly made on behalf of Macmillan Publishers Limited or one of its agents. Please note that neither Macmillan Publishers Limited nor any of its agents accept any responsibility for viruses that may be contained in this e-mail or its attachments and it is your responsibility to scan the e-mail and attachments (if any). No contracts may be concluded on behalf of Macmillan Publishers Limited or its agents by means of e-mail communication. Macmillan Publishers Limited Registered in England and Wales with registered number 785998 Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS ******************************************************************************** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
