Example usage for org.apache.commons.logging LogConfigurationException printStackTrace

List of usage examples for org.apache.commons.logging LogConfigurationException printStackTrace

Introduction

In this page you can find the example usage for org.apache.commons.logging LogConfigurationException printStackTrace.

Prototype

public void printStackTrace(PrintStream s) 

Source Link

Document

Prints this throwable and its backtrace to the specified print stream.

Usage

From source file:org.apache.tools.ant.listener.CommonsLoggingListener.java

private Log getLog(String cat, String suffix) {
    if (suffix != null) {
        suffix = suffix.replace('.', '-');
        suffix = suffix.replace(' ', '-');
        cat = cat + "." + suffix;
    }/*from   w ww . j a va  2  s.  c om*/
    final PrintStream tmpOut = System.out;
    final PrintStream tmpErr = System.err;
    System.setOut(out);
    System.setErr(err);

    if (!initialized) {
        try {
            logFactory = LogFactory.getFactory();
        } catch (final LogConfigurationException e) {
            e.printStackTrace(System.err);
            return null;
        }
    }

    initialized = true;
    final Log log = logFactory.getInstance(cat);
    System.setOut(tmpOut);
    System.setErr(tmpErr);
    return log;
}