[vtkusers] vtkGenericDataObjectReader, error handling
Michal Szostakiewicz
creed at icm.edu.pl
Mon Apr 29 06:06:36 EDT 2013
> I looked at this ErrorObserver class, but is there any way to use this
> technique in Java wrapper?
>
> What I basically need is just to "ignore" all the errors... Maybe there is
> some "built-in" vtkCommand to do that?
OK, I found _some_ solution - I though it would be nice to post it here -
but I still have some questions :)
So, first of all I come across this great wiki document and example:
http://www.vtk.org/Wiki/VTK/Java_Wrapping
What's especially interesting is this:
vtkNativeLibrary.DisableOutputWindow(null);
part (although loading native library method also looks nice)
It almost resolves my error handling problem, but still I wonder:
1. Is there any way to just _ignore_ all the errors (i.e. not to log them
to any file)?
2. If not, I would prefer to log them to my existing logfile. I can do
that by passing a File to DisplayOutputWindow, but it looks like this file
is always overwritten. Perhaps it would be a good idea to also add an
option if the file should be appended or not.
For the convenience of those of you who don't know Java wrapper,
DisplayOutputWindow "unrolls" to:
public static void DisableOutputWindow(File logFile) {
if(logFile == null) {
logFile = new File("vtkError.txt");
}
vtkFileOutputWindow outputError = new vtkFileOutputWindow();
outputError.SetFileName(logFile.getAbsolutePath());
outputError.SetInstance(outputError);
}
So I believe it's just a matter of adding
outputError.SetAppend(1);
but I'm not really an expert :)
Best regards,
Michał
More information about the vtkusers
mailing list