brunorozendo / log4jdbc-log4j2

Automatically exported from code.google.com/p/log4jdbc-log4j2
48 stars 39 forks source link

Incorrect date format logged for MySQL #42

Open alexanderabramov opened 5 years ago

alexanderabramov commented 5 years ago

https://github.com/brunorozendo/log4jdbc-log4j2/blob/master/log4jdbc-log4j2-jdbc4.1/src/main/java/net/sf/log4jdbc/sql/jdbcapi/DriverSpy.java#L222

rdbmsSpecifics does not include new MySQL driver com.mysql.cj.jdbc.Driver, so it logs dates using default format (e.g. '12/31/2018 00:00:00.000'), not MySqlRdbmsSpecifics (e.g. '2018-12-31 00:00:00'

As a result logging line is confusing and no longer directly executable in mysql console.

Related to #32

brunorozendo commented 5 years ago

its been already solved: https://github.com/brunorozendo/log4jdbc-log4j2/issues/40

alexanderabramov commented 5 years ago

How is linked #40 related? That one is about loading the driver, this one is about configuring rdbmsSpecifics for a driver. There is no configuration setting for rdbmsSpecifics.

This commit fixes the issue: https://github.com/alexanderabramov/log4jdbc-log4j2/commit/d74bfa27027564a59d2433b1e9e219b68e35060f

brunorozendo commented 5 years ago

Please check this link https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-driver-name.html

alexanderabramov commented 5 years ago

Sorry, I don't understand what you are saying.

Your link says com.mysql.cj.jdbc.Driver is the correct driver name.

log4jdbc-log4j2 source code does not have rdms specifics configured for this driver name. Therefore it does not print dates correctly.

Commit I've linked adds it. Therefore it starts printing dates correctly.

MisterKrab commented 6 months ago

Sorry, I don't understand what you are saying.

Your link says com.mysql.cj.jdbc.Driver is the correct driver name.

log4jdbc-log4j2 source code does not have rdms specifics configured for this driver name. Therefore it does not print dates correctly.

Commit I've linked adds it. Therefore it starts printing dates correctly.

image

Yeah, I have the same question.

MisterKrab commented 6 months ago

Sorry, I don't understand what you are saying. Your link says com.mysql.cj.jdbc.Driver is the correct driver name. log4jdbc-log4j2 source code does not have rdms specifics configured for this driver name. Therefore it does not print dates correctly. Commit I've linked adds it. Therefore it starts printing dates correctly.

image

Yeah, I have the same question.

When I edit the source code and change driver name to "com.mysql.cj.jdbc.Driver" ,It works