Sebastian G. Sebastian G. - 15 days ago 10
Java Question

Cannot disable ORMLites Logging

So, my problem is:

I need to disable ORMLites Logging.

I already tried

System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "ERROR");


On a JavaFX Application, this worked.
But now I have a console program where this doesnt want to work...
First theory I have is:

I am using an seperate Logger with a FileHandler. Does this maybe interfere with LocalLog? Setting the property works, but this does no change to the output.

Edit: Regarding differences between the both projects:

I use commons logging in the non-FX Project. Could this be the reason why it isnt working? (I use it because of commons csv and commons configuration... not for logging)

Answer

I am using an separate Logger with a FileHandler. Does this maybe interfere with LocalLog? Setting the property works, but this does no change to the output.

ORMLite tries to detect and use other logging libraries if available. I suspect that it is finding another logging implementation and use it. You can force it to use one logger however with:

System.setProperty("com.j256.ormlite.logger.type", "LOCAL");

or

-Dcom.j256.ormlite.logger.type=LOCAL

Then you can set the log level with:

System.setProperty("com.j256.ormlite.logger.level", "ERROR");

or

-Dcom.j256.ormlite.logger.level=ERROR