Package org.apache.commons.logging

Examples of org.apache.commons.logging.Log


    /**
     * Must be called exactly once, and must be called before any call
     * to the configure method.
     */
    public void init(Digester digester, PluginManager pm) throws PluginException {
        Log log = digester.getLogger();
        boolean debug = log.isDebugEnabled();
        if (debug) {
            log.debug("init being called!");
        }
       
        if (initialized) {
            throw new PluginAssertionFailure("Init called multiple times.");
        }

        if ((pluginClass == null) && (pluginClassName != null)) {
            try {
                // load the plugin class object
                pluginClass =
                    digester.getClassLoader().loadClass(pluginClassName);
            } catch(ClassNotFoundException cnfe) {
                throw new PluginException(
                    "Unable to load class " + pluginClassName, cnfe);
            }
        }

        if (ruleLoader == null) {
            // the caller didn't provide a ruleLoader to the constructor,
            // so get the plugin manager to "discover" one.
            log.debug("Searching for ruleloader...");
            ruleLoader = pm.findLoader(digester, id, pluginClass, properties);
        } else {
            log.debug("This declaration has an explicit ruleLoader.");
        }
       
        if (debug) {
            if (ruleLoader == null) {
                log.debug(
                    "No ruleLoader found for plugin declaration"
                    + " id [" + id + "]"
                    + ", class [" + pluginClass.getClass().getName() + "].");
            } else {
                log.debug(
                    "RuleLoader of type [" + ruleLoader.getClass().getName()
                    + "] associated with plugin declaration"
                    + " id [" + id + "]"
                    + ", class [" + pluginClass.getClass().getName() + "].");
            }
View Full Code Here


     * specified digester object.
     */
    
    public void configure(Digester digester, String pattern)
                          throws PluginException {
        Log log = digester.getLogger();
        boolean debug = log.isDebugEnabled();
        if (debug) {
            log.debug("configure being called!");
        }
       
        if (!initialized) {
            throw new PluginAssertionFailure("Not initialized.");
        }
View Full Code Here

     * logging is disabled from this method.
     *
     *@param decl an object representing a plugin class.
     */
    public void addDeclaration(Declaration decl) {
        Log log = LogUtils.getLogger(null);
        boolean debug = log.isDebugEnabled();
       
        Class pluginClass = decl.getPluginClass();
        String id = decl.getId();
       
        declarationsByClass.put(pluginClass.getName(), decl);
           
        if (id != null) {
            declarationsById.put(id, decl);
            if (debug) {
                log.debug(
                    "Indexing plugin-id [" + id + "]" +
                    " -> class [" + pluginClass.getName() + "]");
            }
        }
    }
View Full Code Here

        // iterate over the list of RuleFinders, trying each one
        // until one of them locates a source of dynamic rules given
        // this specific plugin class and the associated declaration
        // properties.
        Log log = LogUtils.getLogger(digester);
        boolean debug = log.isDebugEnabled();
        log.debug("scanning ruleFinders to locate loader..");
       
        List ruleFinders = pluginContext.getRuleFinders();
        RuleLoader ruleLoader = null;
        try {
            for(Iterator i = ruleFinders.iterator();
                i.hasNext() && ruleLoader == null; ) {
                   
                RuleFinder finder = (RuleFinder) i.next();
                if (debug) {
                    log.debug("checking finder of type " + finder.getClass().getName());
                }
                ruleLoader = finder.findLoader(digester, pluginClass, props);
            }
        }
        catch(PluginException e) {
            throw new PluginException(
                "Unable to locate plugin rules for plugin"
                + " with id [" + id + "]"
                + ", and class [" + pluginClass.getName() + "]"
                + ":" + e.getMessage(), e.getCause());
        }
        log.debug("scanned ruleFinders.");
       
        return ruleLoader;
    }
View Full Code Here

   
    /**
     * Just add a SetPropertiesRule at the specified path.
     */
    public void addRules(Digester digester, String path) {
        Log log = digester.getLogger();
        boolean debug = log.isDebugEnabled();
        if (debug) {
            log.debug(
                "LoaderSetProperties loading rules for plugin at path ["
                + path + "]");
        }

        digester.addSetProperties(path);
View Full Code Here

        Container root = new Container();
        digester.push(root);
       
        Exception exception = null;
        Log oldLog = digester.getLogger();
        try {
            digester.setLogger(new NoOpLog());
            digester.parse(
                TestAll.getInputStream(this, "test2.xml"));
        }
View Full Code Here

        Container root = new Container();
        digester.push(root);
       
        Exception exception = null;
        Log oldLog = digester.getLogger();
        try {
            digester.setLogger(new NoOpLog());
            digester.parse(
                TestAll.getInputStream(this, "test2.xml"));
        }
View Full Code Here

                                 ? (int)(partLength - totalRead) : MAX_BYTES_TO_READ);
        }
      } catch (IOException ie) {
        TaskTracker tracker =
          (TaskTracker) context.getAttribute("task.tracker");
        Log log = (Log) context.getAttribute("log");
        String errorMsg = ("getMapOutput(" + mapId + "," + reduceId +
                           ") failed :\n"+
                           StringUtils.stringifyException(ie));
        log.warn(errorMsg);
        if (isInputException) {
          tracker.mapOutputLost(mapId, errorMsg);
        }
        response.sendError(HttpServletResponse.SC_GONE, errorMsg);
        throw ie;
View Full Code Here

*/
public class TestErrorHandler extends FrameworkTestCase
{
    public void testDefaultErrorHandlerWithLocation()
    {
        Log log = (Log) newMock(Log.class);

        Resource r = new ClasspathResource(getClassResolver(), "/foo/bar/Baz.module");
        Location l = new LocationImpl(r, 13);

        Throwable ex = new IllegalArgumentException();

        log.error("Error at classpath:/foo/bar/Baz.module, line 13: Bad frob value.", ex);

        replayControls();

        ErrorHandler eh = new DefaultErrorHandler();

View Full Code Here

        verifyControls();
    }

    public void testDefaultErrorHandlerWithNoLocation()
    {
        Log log = (Log) newMock(Log.class);

        Throwable ex = new IllegalArgumentException();

        log.error("Error: Bad frob value.", ex);

        replayControls();

        ErrorHandler eh = new DefaultErrorHandler();
View Full Code Here

TOP

Related Classes of org.apache.commons.logging.Log

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.