Reputation: 15844
I have written a method for closing files
private void closeFiles(Closeable ... files) {
for (Closeable file : files) {
if (file != null) {
try {
file.close();
} catch (IOException ioe) {
// org.apache.log4j.Logger
logger.error("Unable to close file.", ioe);
}
}
}
}
and then I found out that Guava provides the closeQuietly
method which basicaly does the same thing. The only difference is using java.util.logging.Logger
for logging. If an exception occurs in Guava, will it be logged into a file (configured for log4j
) or not?
Upvotes: 1
Views: 1006
Reputation: 14649
I think not. You has to write own handler. See for example Routing java.util.logging messages to Log4J
Upvotes: 3