If I am not mistaken your conversion pattern "[%p] %c{1} %m%n" does
not match the output, so it is very likely that some other dependency
and/or container trigger Log4J initialization prior to your code being
executed.
Andrus
On Feb 6, 2008, at 11:57 AM, Alexander Lamb (dev) wrote:
Well, I tried but didn't work.
Indeed, BEFORE loading a model (I have two models that I load
explicitly) I do:
public AppModule() {
System.out.println("---- AppModule init...");
System.out.println("----- LOG4J: " + getClass().getResource("/
log4j.properties"));
org
.apache
.log4j.PropertyConfigurator.configure(getClass().getResource("/
log4j.properties"));
}
The log4j.properties contains:
log4j.rootCategory=WARN, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=[%p] %c{1} %m%n
log4j.category.org.apache.tapestry.TapestryFilter=info
log4j.category.org.apache.tapestry=error
log4j.category.tapestry=error
log4j.category.ch.rodano.studies=error
log4j.category.ch.rodano.studies.model=error
# Service category names are the name of the defining module class
# and then the service id.
log4j.category.ch.rodano.studies.services.AppModule.TimingFilter=info
log4j.logger.org.apache.cayenne.access.QueryLogger = WARN
log4j.logger.org.apache.cayenne.conf = WARN
log4j.logger.org.apache.cayenne.util = WARN
And here is what I get in the console:
---- AppModule init...
----- LOG4J: file:/Users/alamb/Workspace/top2/src/main/resources/
log4j.properties
---- Initializer starting...
10:54:00.042 INFO [main]
org
.apache
.cayenne
.conf.RuntimeLoadDelegate.startedLoading(RuntimeLoadDelegate.java:
572) >64> started configuration loading.
10:54:00.045 INFO [main]
org
.apache
.cayenne
.conf
.RuntimeLoadDelegate.shouldLoadDataDomain(RuntimeLoadDelegate.java:
151) >74> loaded domain: Studies
10:54:00.218 INFO [main]
org
.apache
.cayenne
.conf.RuntimeLoadDelegate.loadDataMap(RuntimeLoadDelegate.java:222)
>75> loaded <map name='StudiesMap' location='StudiesMap.map.xml'>.
10:54:00.219 INFO [main]
org
.apache
.cayenne
.conf
.RuntimeLoadDelegate.shouldLoadDataNode(RuntimeLoadDelegate.java:
261) >74> loading <node name='StudiesNode'
datasource='StudiesNode.driver.xml'
factory='org.apache.cayenne.conf.DriverDataSourceFactory'>.
10:54:00.229 INFO [main]
org
.apache
.cayenne
.conf
.RuntimeLoadDelegate.shouldLoadDataNode(RuntimeLoadDelegate.java:
305) >74> using factory:
org.apache.cayenne.conf.DriverDataSourceFactory
10:54:00.229 INFO [main]
org
.apache
.cayenne
.conf.DriverDataSourceFactory.load(DriverDataSourceFactory.java:115)
>76> loading driver information from 'StudiesNode.driver.xml'.
10:54:00.234 INFO [main]
org.apache.cayenne.conf.DriverDataSourceFactory
$DriverHandler.init(DriverDataSourceFactory.java:169) >87> loading
driver com.mysql.jdbc.Driver
10:54:00.240 INFO [main]
org.apache.cayenne.conf.DriverDataSourceFactory
$LoginHandler.init(DriverDataSourceFactory.java:297) >87> loading
user name and password.
10:54:00.245 INFO [main]
org
.apache.cayenne.access.QueryLogger.logPoolCreated(QueryLogger.java:
222) >78> Created connection pool: jdbc:mysql://localhost/roles_new
Driver class: com.mysql.jdbc.Driver
Min. connections in the pool: 1
Max. connections in the pool: 20
Followed by the second model loading and then all the SQL logging...
What did I do wrong?
Alex
Le 5 févr. 08 à 18:07, Andrus Adamchik a écrit :
As a background to what Kevin just said, Cayenne itself no longer
attempts to configure Log4J (something it did prior to 3.0). Log4J
is optional and is expected to be configured by the user.
http://cayenne.apache.org/doc/guide-to-30-features.html
(search for "logging" on this page).
Andrus
On Feb 5, 2008, at 6:32 PM, Kevin Menard wrote:
How are you bootstrapping your log4j configuration? I have
something like
the following before creating a DC:
org
.apache
.log4j.PropertyConfigurator.configure(getClass().getResource("/log
4j.properties"));
--
Kevin
On 2/5/08 11:29 AM, "Alexander Lamb (dev)" <[EMAIL PROTECTED]> wrote:
Hello List,
I don't seem to be able to stop Cayenne log all the SQL (3.0M2 or
M3).
I have the following in my log4j.properties, but it doesn't seem
to be
taken into account!
log4j.category.org.apache.cayenne.access.QueryLogger = WARN
log4j.category.org.apache.cayenne.conf = WARN
log4j.category.org.apache.cayenne.util = WARN
Thanks,
Alex