korma / Korma

Tasty SQL for Clojure.
http://sqlkorma.com
1.48k stars 222 forks source link

Disable console logging #265

Closed alolis closed 9 years ago

alolis commented 9 years ago

OK, i know the following isn't exactly a big deal, or it's probably not related with korma directly, but it has been driving me insane. I am inserting on purpose a row which causes a duplicate exception, and even though I have disabled logging via log4j for everything, I get messages like this in the console:

Failure to execute query with SQL:
INSERT INTO `test` (`test`) VALUES (?)  ::  [1]
MySQLIntegrityConstraintViolationException:
 Message: Duplicate entry '1' for key 'test'
 SQLState: 23000
 Error Code: 1062

I also tried to use logger: NullLogger in the defdb configuration but it didn't help either. If anyone has an idea about this, please, do share with me.

I am using korma with [mysql/mysql-connector-java "5.1.34"] by the way.

immoh commented 9 years ago

Those messages are coming from Korma: https://github.com/korma/Korma/blob/master/src/korma/db.clj#L248-250

I have no idea what is the purpose of handling exceptions in such way. I have to dig into the history to see if those printlns could be removed entirely.

alolis commented 9 years ago

At least now I know where they are coming from. I was sure it was a printing somewhere because they were still printing even if I had all logging disabled.

PeterFaiman commented 9 years ago

This is driving me wacko, please kill these lines or make a way to disable them.

I have no idea what is the purpose of handling exceptions in such way. I have to dig into the history to see if those printlns could be removed entirely.

@immoh I did it for you.

I think they were just debugging prints that survived for a long time. Or at least meant to be changed later. They can be safely removed, or at least given a config option.

danielflower commented 9 years ago

Nice to see this already fixed, but when can it be released?

immoh commented 9 years ago

I'll try to make a release soon, probably next week.

elrob commented 9 years ago

We have also noticed this problem and would benefit from the new release. Edit: Just noticed the new release. Thanks

danielflower commented 9 years ago

Just upgraded and it's working great. Thanks!