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)
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
Ok, I found the culprit:
Apache Commons Logging seems to cause an issue somewhere.... Not sure why, but removing it solved the issue.
If Gray has an explanation for this, i will mark his answer as the solved one. But for now I have my problem solved.
EDIT: If you still need Commons.Logging for your Application to work, you can use this:
System.setProperty("org.apache.commons.logging.Log",
"org.apache.commons.logging.impl.NoOpLog");
This removed all the messages from ORMLite.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With