Package org.apache.log4j

Examples of org.apache.log4j.Category$PrivateFactory


    }
   
    public void targetFinished(BuildEvent event) {
        if (initialized) {
            String targetName = event.getTarget().getName();
            Category cat = Category.getInstance(Target.class.getName());
            if (event.getException() == null) {
                cat.info("Target \"" + event.getTarget().getName() + "\" finished.");
            }
            else {
                cat.error("Target \"" + event.getTarget().getName() + "\" finished with error.", event.getException());
            }
        }
    }
View Full Code Here


    }
   
    public void taskStarted(BuildEvent event) {
        if (initialized) {
            Task task = event.getTask();
            Category cat = Category.getInstance(task.getClass().getName());
            cat.info("Task \"" + task.getTaskName() + "\" started.");
        }
    }
View Full Code Here

    }
   
    public void taskFinished(BuildEvent event) {
        if (initialized) {
            Task task = event.getTask();
            Category cat = Category.getInstance(task.getClass().getName());
            if (event.getException() == null) {
                cat.info("Task \"" + task.getTaskName() + "\" finished.");
            }
            else {
                cat.error("Task \"" + task.getTaskName() + "\" finished with error.", event.getException());
            }
        }
    }
View Full Code Here

                if (categoryObject == null) {
                    categoryObject = event.getProject();
                }
            }
           
            Category cat = Category.getInstance(categoryObject.getClass().getName());
            switch (event.getPriority()) {
                case Project.MSG_ERR:
                    cat.error(event.getMessage());
                    break;
                case Project.MSG_WARN:
                    cat.warn(event.getMessage());
                    break;
                case Project.MSG_INFO:
                    cat.info(event.getMessage());
                    break;
                case Project.MSG_VERBOSE:
                    cat.debug(event.getMessage());
                    break;
                case Project.MSG_DEBUG:
                    cat.debug(event.getMessage());
                    break;
                default:                       
                    cat.error(event.getMessage());
                    break;
            }
        }
    }
View Full Code Here

     *
     * @param loggerLevel New logger level
     */
    public void setLoggerLevel(String channel, int loggerLevel) {
        Priority priority = toPriority(loggerLevel);
        Category cat = getCategory(channel);
        cat.setPriority(priority);
    }
View Full Code Here

     * Logger level getter.
     *
     * @return int logger level
     */
    public int getLoggerLevel(String channel) {
        Category cat = getCategory(channel);
        return fromPriority(cat.getPriority());
    }
View Full Code Here

     * @param throwable throwable to be logged
     * @param channel channel name used for logging
     * @param level level used for logging
     */
    public void log(Object data, Throwable throwable, String channel, int level) {
        Category cat = getCategory(channel);
        cat.log(toPriority(level), data, throwable);
    }
View Full Code Here

     * @param data The object to log.
     * @param channel The channel name used for logging.
     * @param level The level used for logging.
     */
    public void log(Object data, String channel, int level) {
        Category cat = getCategory(channel);
    if (data instanceof Throwable)
            cat.log(toPriority(level), data, (Throwable)data);
        else 
            cat.log(toPriority(level), data);
    }
View Full Code Here

     * @param channel The channel specification
     * @param level   The level specification
     */

    public boolean isEnabled(String channel, int level) {
        Category cat = getCategory(channel);
        return cat.isEnabledFor(toPriority(level));
    }
View Full Code Here

   
   
    // ------------------------------------------------------ Private/Protected Methods
   
    private Category getCategory(String channel) {
        Category cat = Category.exists(channel);
        if (cat == null) {
            cat = Category.getInstance(channel);
        }
        return cat;
    }
View Full Code Here

TOP

Related Classes of org.apache.log4j.Category$PrivateFactory

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.