cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Borut BolĨina" <borut.bolc...@gmail.com>
Subject Log level INFO for error at creating db table should be WARN
Date Thu, 24 Apr 2008 13:19:07 GMT
Hello,

When running

            DbGenerator generator = new DbGenerator(autoDbAdapter, dataMap);

            generator.setShouldDropTables(false);
            generator.setShouldCreateFKConstraints(false);
            generator.setShouldDropPKSupport(false);
            generator.setShouldCreatePKSupport(true);

            generator.runGenerator(dataSource);

and the database tables already exist and the logger is configured like

            log4j.logger.org.apache.cayenne.access.QueryLogger = info

the log output looks like:

 INFO [14:49:11.665] CREATE TABLE template (id INT NOT NULL, name
VARCHAR(255) NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB
 INFO [14:49:11.665] *** error.
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'template'
already exists
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1026)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
        at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:734)
        at
org.apache.cayenne.access.DbGenerator.safeExecute(DbGenerator.java:352)
        at
org.apache.cayenne.access.DbGenerator.runGenerator(DbGenerator.java:293)
        at
com.interseek.portal.server.Bootstrap.createTables(Bootstrap.java:155)
        at com.interseek.portal.server.Bootstrap.<init>(Bootstrap.java:58)
        at com.interseek.portal.server.Bootstrap.main(Bootstrap.java:71)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:271)
        at java.lang.Thread.run(Thread.java:595)

Wouldn't it be more appropriate if the level for ***error was WARN?

How should I configure the logger to supress this ***error messages. I want
to log them nicely with:

            ValidationResult validationResult = generator.getFailures();
            List<ValidationFailure> list = validationResult.getFailures();
            if (list.isEmpty()) {
                logger.info("Database tables generated
successfully.");
            }
            for (ValidationFailure validationFailure : list) {
                logger.warn(validationFailure.getDescription());
            }

Cheers,
Borut

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message