[kaffe]printing to a file in kaffe
robilad at kaffe.org
Thu Sep 2 02:00:52 PDT 2004
> Hi Dalibor,
> The problem with using dprintf and configure options in this
> scenario is
> there will be a lot of information and parameters printed to the file
> which I may not need.
> I have put some specific hooks in the JVM(these are the only things
> that I want) using fprintf with which I'm unable to get it in the
> correct format. I also used flock but with no result. Could you please
> help me with any ideas other than dprintf and configuring in the debug mode.
As the debugging output seems to work without the problems you seem to
be having, I'd personally go for that. You don't have to use what's
there, of course ;)
Another option to use the framework that already exists within kaffe
would be to add your own debugging output type, like GCALLOC, for
example, and to use that to output information using DBG() macros in the
way you need it.
You could also try using dprintf directly, without all the debugging
output nonsense ;) It's got the same parameters as printf and will write
your strings to stderr. Just change your calls from printf(...) to
dprintf(...) to give it a try.
Finally, failing that, you could take a look at the kaffe_dprintf
function itself, defined in kaffe/kaffevm/debug.c, and reuse some ideas
in your own, thread safe printing mechanism, like using write,
evaluating all the parameters before writing to stream, etc.
But I'd recommend simply giving dprintf a chance.
More information about the kaffe