FAQ
Log level INFO for error at creating db table should be WARN
------------------------------------------------------------

Key: CAY-1039
URL: https://issues.apache.org/cayenne/browse/CAY-1039
Project: Cayenne
Issue Type: Improvement
Components: Cayenne Core Library
Affects Versions: 3.0
Environment: 3.0M3
Reporter: Borut Bolčina
Assignee: Andrus Adamchik
Priority: Minor


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.(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.error(validationFailure.getDescription());
}



--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Search Discussions

  • Anonymous at Aug 21, 2008 at 12:16 am
    [ https://issues.apache.org/cayenne/browse/CAY-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Kevin Menard reassigned CAY-1039:
    ---------------------------------

    Assignee: Kevin Menard (was: Andrus Adamchik)
    Log level INFO for error at creating db table should be WARN
    ------------------------------------------------------------

    Key: CAY-1039
    URL: https://issues.apache.org/cayenne/browse/CAY-1039
    Project: Cayenne
    Issue Type: Improvement
    Components: Cayenne Core Library
    Affects Versions: 3.0
    Environment: 3.0M3
    Reporter: Borut Bolčina
    Assignee: Kevin Menard
    Priority: Minor

    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.error(validationFailure.getDescription());
    }
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Anonymous at Aug 23, 2008 at 12:07 pm
    [ https://issues.apache.org/cayenne/browse/CAY-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13069#action_13069 ]

    Andrus Adamchik commented on CAY-1039:
    --------------------------------------

    I am not sure that suggested fix would work. Changing exception logging to WARN will actually make it harder to suppress, and making it DEBUG inside the QueryLogger would affect other users of this method. I guess we can log it via DbGenerator's own logger as DEBUG instead of doing QueryLogger.logQueryError(ex)
    Log level INFO for error at creating db table should be WARN
    ------------------------------------------------------------

    Key: CAY-1039
    URL: https://issues.apache.org/cayenne/browse/CAY-1039
    Project: Cayenne
    Issue Type: Improvement
    Components: Cayenne Core Library
    Affects Versions: 3.0
    Environment: 3.0M3
    Reporter: Borut Bolčina
    Assignee: Kevin Menard
    Priority: Minor

    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.error(validationFailure.getDescription());
    }
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Anonymous at Aug 23, 2008 at 3:20 pm
    [ https://issues.apache.org/cayenne/browse/CAY-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13070#action_13070 ]

    Kevin Menard commented on CAY-1039:
    -----------------------------------

    I think it makes more sense at WARN than at DEBUG or INFO, regardless of ability to suppress. The very first line of the message is "*** error", which I think makes it more severe than DEBUG and INFO messages normally are. But, it's a soft error, so ERROR would be inappropriate.

    Or, if the message doesn't really mean much, we could change the log level to a less severe one, but I wouldn't state "error" in the log message then. It seems to send out mixed signals.
    Log level INFO for error at creating db table should be WARN
    ------------------------------------------------------------

    Key: CAY-1039
    URL: https://issues.apache.org/cayenne/browse/CAY-1039
    Project: Cayenne
    Issue Type: Improvement
    Components: Cayenne Core Library
    Affects Versions: 3.0
    Environment: 3.0M3
    Reporter: Borut Bolčina
    Assignee: Kevin Menard
    Priority: Minor

    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.error(validationFailure.getDescription());
    }
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Anonymous at Aug 23, 2008 at 3:26 pm
    [ https://issues.apache.org/cayenne/browse/CAY-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13072#action_13072 ]

    Andrus Adamchik commented on CAY-1039:
    --------------------------------------

    sure, let's change the message wording.
    Log level INFO for error at creating db table should be WARN
    ------------------------------------------------------------

    Key: CAY-1039
    URL: https://issues.apache.org/cayenne/browse/CAY-1039
    Project: Cayenne
    Issue Type: Improvement
    Components: Cayenne Core Library
    Affects Versions: 3.0
    Environment: 3.0M3
    Reporter: Borut Bolčina
    Assignee: Kevin Menard
    Priority: Minor

    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.error(validationFailure.getDescription());
    }
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Anonymous at Sep 12, 2008 at 8:57 pm
    [ https://issues.apache.org/cayenne/browse/CAY-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13099#action_13099 ]

    Kevin Menard commented on CAY-1039:
    -----------------------------------

    Looking at this a bit more, changing the message and the log level just pushes the problem elsewhere. E.g., attempting to create a table with an invalid schema name is a hard error. The log level of INFO is probably inappropriate in this case, but the "*** error" is.

    I'll have to think about this a bit more, but there may just not be enough we can do. The only way I see to get accurate messages across the board is to look at each driver's custom exceptions and log accordingly.
    Log level INFO for error at creating db table should be WARN
    ------------------------------------------------------------

    Key: CAY-1039
    URL: https://issues.apache.org/cayenne/browse/CAY-1039
    Project: Cayenne
    Issue Type: Improvement
    Components: Cayenne Core Library
    Affects Versions: 3.0
    Environment: 3.0M3
    Reporter: Borut Bolčina
    Assignee: Kevin Menard
    Priority: Minor

    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.error(validationFailure.getDescription());
    }
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categoriescayenne
postedApr 24, '08 at 1:20p
activeSep 12, '08 at 8:57p
posts6
users1
websitecayenne.apache.org

1 user in discussion

Anonymous: 6 posts

People

Translate

site design / logo © 2022 Grokbase