db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Leader <d.lea...@bio.gla.ac.uk>
Subject Re: Can the derby.log file be suppressed?
Date Tue, 23 Oct 2007 15:50:45 GMT
About a week ago I wrote:

> 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?

and Knut Anders Hatlen replied

> 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
>     public static final OutputStream DEV_NULL = new OutputStream() {
>             public void write(int b) { }
>         };
> then you can suppress the derby.log file by setting
> derby.stream.error.field to "MyApp.DEV_NULL".

Many thanks.

I've just got round to implementing this. I'm having a problem with  
one platform however. On Mac OS X I was able to set the  
derby.stream.error.field to MyApp.DEV_NULL in the info.plist by  
making a Java Property in the Property list. This worked fine.  
However my attempts to do something analogous in Windows have all  
failed. I'm using exe4j to package the jar file into a .exe, where  
there are options to set VM parameters and Arguments, but either  
neither of these is the right place or, more likely, my syntax is  
wrong, as I know next to nothing about Windows.

Ironically, I don't even need to do this on the Mac as I have managed  
to include the derby db in my application package (so it the log file  
got written there until I did the above) - something that I can't  
find info on for an .exe. So it would be nice to suppress the log  
file for Windows users of my app. Anyone can help me the last mile on  
this one?


View raw message