A quick tip from the Derby user's list, that I thought was very useful, particuarly in embedded situations where you don't want to leave detritus around when you're running Derby.
A user asks:
I'm about to distribute my java app with an embedded derby database,
but it's really not polite for apps to write unsolicited files to
disc. Anyway of suppressing the derby.log file?
Knut Anders from the Java DB team has a great suggestion:
You could take a look at the derby.stream.error.field property:
http://db.apache.org/derby/docs/10.3/tuning/rtunproper33027.html
If you create a stream object which swallows whatever is passed in to
its write() method and put it in a public static field in the class
MyApp, like this
then you can suppress the derby.log file by setting
public static final OutputStream DEV_NULL = new OutputStream() {
public void write(int b) { }
};
derby.stream.error.field to "MyApp.DEV_NULL".
3 comments:
Good tip. Note our Esteemed Host accidentally left a stray quote character in the link, so it will 404. After it does, just chop out the %22 at the end :)
Thank you, Dear (Anonymous) Reader. I have fixed the %22 bug.
Yes, it's true... this annoying "feature" is still included into Derby.
Many thanks for your tip! I've used it in my application:
ejisto's Main class
:)
Post a Comment