Hi all!

I'm not on this list, but I think, you are or someone who's looking for an
answer is interested in solving the log4j error in torque-gen und torque.

The problem is, that torque and torque-gen report a problem, that there is
no log4j appender for org.apache.torque-gen.engine and
org.apache.torque.engine.

[torque-data-model] log4j:ERROR Could not find value for key
log4j.appender.org.apache.torque.engine
[torque-data-model] log4j:ERROR Could not instantiate appender named
"org.apache.torque.engine".
(for torque-gen its of course log4j.appender.org.apache.torque-gen.engine)

The solution is:
Add the following three lines to the log4j.properties inside the
torque-gen-3.1.jar 

log4j.appender.org.apache.torque.engine = org.apache.log4j.ConsoleAppender
log4j.appender.org.apache.torque.engine.layout =
org.apache.log4j.PatternLayout
log4j.appender.org.apache.torque.engine.layout.conversionPattern =
%d{HH:mm:ss} %-5p %c (line %L) - %m%n

This doesn't come from me, but I've the problem, that the normal (runtime)
torque-3.1.jar has the same problem and prints out all DEBUG messages.
That's not very nice, if you want to use it in a production environment.

So, you have to change the torque-3.1.jar as well. Normally there is no
log4j.properties file in the torque-3.1 jar. Create it with the content from
the torque-3.1.jar/log4.properties (and replace torque-gen with torque) and
the error is gone. But copy also the simplelog.properties and
commons-logging.properties to the torque-3.1.jar and change in the
simplelog.properties the attribute
org.apache.commons.logging.simplelog.defaultlog from debug to the following
value

org.apache.commons.logging.simplelog.defaultlog=info

After that, there is no debug message during runtime coming from torque....

At the end I would like to make a comment to the developers. Torque is very
nice, it's very easy to use  - BUT such a "mistake" should be avoided. Why
do I've to change a file inside a library file to configure logging
facilities. This MUST be available from outside. Additionally I'm asking me,
why do you use two different logging mechanism (log4j and commons-logging).
Isn't it possible to come right with one of it? And of course - why is the
problem not documented...or when - I couldn't find it.


Thanks and Bye
Thoralf

Reply via email to