Aviral
Aviral

Reputation: 41

Disable logging in log4j for jasper report

I have created a java application in which a report is to be generated. The report is made in iReports 3.7.5. The problem is that my application uses log4j to log errors, and even the report is using log4j to log its errors and there seems to some kind of conflict between the two. I have tried changing the jar files but to no success. I included the report in another project which does not use log4j, and the report is being generated fine. Any help would be appreciated. The error that I get is

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your
SQLsyntax; check the manual that corresponds to your MySQL server version for the
right syntax to use near 'isTrue': replacing [Generic bean: class 
[org.springframework.beans.factory.confi' at line 1

Aviral

Upvotes: 3

Views: 1909

Answers (1)

Glen P
Glen P

Reputation: 709

Are you saying that you have two versions of log4J on your classpath and that is causing problems?

If so, you just need to change the name of the packages one is in. Using automatic refactoring tools in your IDE rename YOUR log4j to from com.log4j.* to mylog4j.* (or whatever you want). Obviously you need to change but the log4j jar as well as all references in your code. Again this can be done automatically by refactoring tools.

This should eliminate your conflict :)

If you really want them to work together you are probably going to have to ask the log4j people what versions are compatible. (more work).

Good luck.

Someone give me a plus one :P

Upvotes: 1

Related Questions