Example usage for org.apache.commons.logging LogFactory getLog

List of usage examples for org.apache.commons.logging LogFactory getLog

Introduction

In this page you can find the example usage for org.apache.commons.logging LogFactory getLog.

Prototype

public static Log getLog(String name) 

Source Link

Document

Convenience method to return a named logger.

Usage

From source file:com.amazonaws.client.util.sdk.SdkInputStream.java

/**
 * Aborts with subclass specific abortion logic executed if needed.
 * Note the interrupted status of the thread is cleared by this method.
 * @throws AbortedException if found necessary.
 *//*from   w  w  w  . j  a  v a  2  s  .  c o m*/
protected final void abortIfNeeded() {
    if (shouldAbort()) {
        try {
            abort(); // execute subclass specific abortion logic
        } catch (IOException e) {
            LogFactory.getLog(getClass()).debug("FYI", e);
        }
        throw new AbortedException();
    }
}

From source file:com.acciente.induction.template.FreemarkerTemplatingEngine.java

public FreemarkerTemplatingEngine(Config.Templating oConfig, ClassLoader oClassLoader,
        ServletConfig oServletConfig) throws IOException, ClassNotFoundException {
    Log oLog;/*from  w w  w  .j a v a 2  s  . c om*/

    oLog = LogFactory.getLog(FreemarkerTemplatingEngine.class);

    _oConfiguration = new Configuration();

    // set up the template loading path
    List oTemplateLoaderList = new ArrayList(oConfig.getTemplatePath().getList().size());

    for (Iterator oIter = oConfig.getTemplatePath().getList().iterator(); oIter.hasNext();) {
        Object oLoaderPathItem = oIter.next();

        if (oLoaderPathItem instanceof Config.Templating.TemplatePath.Dir) {
            Config.Templating.TemplatePath.Dir oDir = (Config.Templating.TemplatePath.Dir) oLoaderPathItem;

            if (!oDir.getDir().exists()) {
                oLog.warn("freemarker > template load path > ignoring missing directory > " + oDir.getDir());
            } else {
                oLog.info("freemarker > template load path > adding directory > " + oDir.getDir());

                oTemplateLoaderList.add(new FileTemplateLoader(oDir.getDir()));
            }
        } else if (oLoaderPathItem instanceof Config.Templating.TemplatePath.LoaderClass) {
            Config.Templating.TemplatePath.LoaderClass oLoaderClass = (Config.Templating.TemplatePath.LoaderClass) oLoaderPathItem;

            Class oClass = Class.forName(oLoaderClass.getLoaderClassName());

            oLog.info("freemarker > template load path > adding class > " + oLoaderClass.getLoaderClassName()
                    + ", prefix: " + oLoaderClass.getPath());

            oTemplateLoaderList.add(new ClassTemplateLoader(oClass, oLoaderClass.getPath()));
        } else if (oLoaderPathItem instanceof Config.Templating.TemplatePath.WebappPath) {
            Config.Templating.TemplatePath.WebappPath oWebappPath = (Config.Templating.TemplatePath.WebappPath) oLoaderPathItem;

            oLog.info("freemarker > template load path > adding webapp path > " + oWebappPath.getPath());

            oTemplateLoaderList
                    .add(new WebappTemplateLoader(oServletConfig.getServletContext(), oWebappPath.getPath()));
        } else {
            throw new IllegalArgumentException(
                    "Unexpected template path type in configuration: " + oLoaderPathItem.getClass());
        }
    }

    TemplateLoader[] oTemplateLoaderArray = new TemplateLoader[oTemplateLoaderList.size()];
    oTemplateLoaderList.toArray(oTemplateLoaderArray);
    _oConfiguration.setTemplateLoader(new MultiTemplateLoader(oTemplateLoaderArray));

    // next set the object wrapper handler
    DefaultObjectWrapper oDefaultObjectWrapper = new DefaultObjectWrapper();

    // should publics fields in views be available in the templates
    oDefaultObjectWrapper.setExposeFields(oConfig.isExposePublicFields());

    oLog.info("freemarker > expose public fields > " + oConfig.isExposePublicFields());

    _oConfiguration.setObjectWrapper(oDefaultObjectWrapper);

    if (oConfig.getLocale() != null) {
        _oConfiguration.setLocale(oConfig.getLocale());

        oLog.info("freemarker > using configured locale > " + oConfig.getLocale());
    } else {
        oLog.warn("freemarker > no locale configured, using default > " + _oConfiguration.getLocale());
    }
}

From source file:gridool.marshaller.JdkMarshaller.java

@SuppressWarnings("unchecked")
@Override/* w  w  w. j  ava2 s  .  c  o  m*/
public <T> T unmarshall(byte[] ary, ClassLoader cl) throws GridException {
    if (cl == null) {
        cl = Thread.currentThread().getContextClassLoader();
    }
    final FastByteArrayInputStream bis = new FastByteArrayInputStream(ary);
    final Object result;
    try {
        CustomObjectInputStream ois = new CustomObjectInputStream(bis, cl);
        result = ois.readObject();
    } catch (IOException e) {
        LogFactory.getLog(getClass()).error(e.getMessage(), e);
        throw new GridException(e);
    } catch (ClassNotFoundException e) {
        LogFactory.getLog(getClass()).error(e.getMessage(), e);
        throw new GridException(e);
    }
    return (T) result;
}

From source file:com.alfaariss.oa.engine.authorization.configuration.ConfigurationFactory.java

/**
 * Creates the object. /* ww  w. j  a v a  2  s. co m*/
 */
public ConfigurationFactory() {
    _logger = LogFactory.getLog(ConfigurationFactory.class);
    _mapProfiles = new HashMap<String, AuthorizationProfile>();
    _bEnabled = true;
}

From source file:de.berlios.jedi.logic.editor.JispPackageJispFileStorer.java

/**
 * Adds a new file to the ZipOutputStream, given the filename and its data.
 * //from   w w w. j  a va2s . c om
 * @param filename
 *            The name of the file to add.
 * @param data
 *            The data of the file.
 */
protected void addFileToStore(String filename, byte[] data) {
    ZipEntry zipEntry = new ZipEntry(filename);

    try {
        outZipped.putNextEntry(zipEntry);
        outZipped.write(data);
        outZipped.closeEntry();
    } catch (IOException e) {
        LogFactory.getLog(JispPackageJispFileStorer.class)
                .warn("A file couldn't be added to the ZipOutputStream", e);
    }
}

From source file:indexer.Index.java

public static Index createIndex(Class<? extends Indexer> i, String indexDirectory) {
    try {/*from   ww w .  ja v a  2 s. co  m*/
        Indexer indexer = i.getConstructor(String.class).newInstance(indexDirectory);
        return getIndex(indexer);
    } catch (InstantiationException | NoSuchMethodException | InvocationTargetException
            | IllegalAccessException e) {
        LogFactory.getLog(Index.class).error("Could not create index.", e);
        return null;
    }
}

From source file:jun.learn.scene.propertysource.MutablePropertySources.java

/**
 * Create a new {@link MutablePropertySources} object.
 */
public MutablePropertySources() {
    this.logger = LogFactory.getLog(getClass());
}

From source file:net.pandoragames.far.ui.swing.component.listener.OperationCallBackListener.java

/**
 * Default constructor.
 */
public OperationCallBackListener() {
    logger = LogFactory.getLog(this.getClass());
}

From source file:com.adaptris.security.TestDefaultSecurityService.java

/** @see TestCase */
public TestDefaultSecurityService(String testName) {
    super(testName);
    if (logR == null) {
        logR = LogFactory.getLog(TestDefaultSecurityService.class);
    }//w w w.  j a v a  2 s .  co  m
}

From source file:com.alfaariss.oa.authentication.password.digest.CryptoDigest.java

/**
 * Constructor. Uses given digest./*from  ww w  . j av  a 2  s  . c  o  m*/
 * @param method The given method.
 */
public CryptoDigest(String method) {
    _sPasswordMethod = method;
    _sProvider = null;
    _logger = LogFactory.getLog(this.getClass());
}