You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Scott Shorter <ss...@orionsec.com> on 2003/10/25 12:48:34 UTC

Log4j settings not utilized?

Okay, here's my logging problem.  I have not used log4j before but I
*have* used java.util.logging which seems to be derived from it.

I'm running my test app from ant, so let me show you a snippet of
build.xml:

<target name="test" depends="compile">
    <java
        classname="net.sourceforge.got.Test"
        fork="true"
        dir=".">
        <classpath refid="classpath"/>
        <jvmarg value="-Dlog4j.configuration=mylog4j.properties"/>
        <jvmarg value="-Dlog4j.debug=1"/>
    </java>
</target>

The mylog4j.properties file can be found inside a mylog4j.jar in my lib
directory.  It reads:

log4j.rootCategory = INFO, default
log4j.appender.default = org.apache.log4j.FileAppender
log4j.appender.default.file = ./torque.log
log4j.appender.default.layout = org.apache.log4j.SimpleLayout

Finally, snippage from my test output:

[DEBUG] TorqueInstance - -init(Torque.properties)
<snip>
[DEBUG] TorqueInstance - -Adding a dummy entry for default, mapped onto
got
log4j: Trying to find [mylog4j.properties] using context classloader
sun.misc.Launcher$AppClassLoader@1ff5ea7.
log4j: Using URL [jar:file:/PATH_TO/lib/mylog4j.jar!/mylog4j.properties]
for automatic log4j configuration.
log4j: Reading configuration from URL
jar:file:/PATH_TO/lib/mylog4j.jar!/mylog4j.properties
log4j: Parsing for [root] with value=[INFO, default].
log4j: Level token is [INFO].
log4j: Category root set to INFO
log4j: Parsing appender named "default".
log4j: Parsing layout options for "default".
log4j: End of parsing for "default".
log4j: Setting property [file] to [./torque.log].
log4j: setFile called: ./torque.log, true
log4j: setFile ended
log4j: Parsed "default" options.
log4j: Finished configuring.
[DEBUG] TorqueInstance - -getConfiguration() =
org.apache.commons.configuration.BaseConfiguration@110b053
[DEBUG] IDBroker - -IDBroker thread was started.

So... Obviously mylog4j.properties *is* being read, and then just as
obviously the Torque logging continues on undeterred.  My primary goal
at the moment is to be able to switch between DEBUG and INFO levels of
logging, but what I did was not effective.

Can anyone please advice?

Thanks,
Scott


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


RE: Log4j settings not utilized?

Posted by Scott Shorter <ss...@orionsec.com>.
> Okay, here's my logging problem.  I have not used log4j before but I
> *have* used java.util.logging which seems to be derived from it.

A followup since I solved the problem (no thanks to this list, ha ha).
It turns out I still had torque-gen-3.1.jar in my classpath, and the
log4j setting were being pulled from there.

Cheers,
Scott


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