user219882
user219882

Reputation: 15844

java.util.logging.Logger and org.apache.log4j.Logger in one application - will the first one log as log4j?

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

Answers (1)

Andrzej Jozwik
Andrzej Jozwik

Reputation: 14649

I think not. You has to write own handler. See for example Routing java.util.logging messages to Log4J

Upvotes: 3

Related Questions