Package org.apache.log4j

Examples of org.apache.log4j.Category$PrivateFactory


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


     * Logger level getter.
     *
     * @return int logger level
     */
    public int getLoggerLevel(String channel) {
        Category cat = getCategory(channel);
        return fromLevel(cat.getLevel());
    }
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(toLevel(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(toLevel(level), data, (Throwable)data);
        else 
            cat.log(toLevel(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(toLevel(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

   
    private boolean initialized = false;
   
    public Log4jListener() {
        initialized = false;
        Category cat = Category.getInstance("org.apache.tools.ant");
        Category rootCat = Category.getRoot();
        if (!(rootCat.getAllAppenders() instanceof NullEnumeration)) {
            initialized = true;
        }
        else {
            cat.error("No log4j.properties in build area");
        }
View Full Code Here

        }
    }
   
    public void buildStarted(BuildEvent event) {
        if (initialized) {
            Category cat = Category.getInstance(Project.class.getName());
            cat.info("Build started.");
        }
    }
View Full Code Here

        }
    }
   
    public void buildFinished(BuildEvent event) {
        if (initialized) {
            Category cat = Category.getInstance(Project.class.getName());
            if (event.getException() == null) {
                cat.info("Build finished.");
            }
            else {
                cat.error("Build finished with error.", event.getException());
            }
        }  
    }
View Full Code Here

        }  
    }
   
    public void targetStarted(BuildEvent event) {
        if (initialized) {
            Category cat = Category.getInstance(Target.class.getName());
            cat.info("Target \"" + event.getTarget().getName() + "\" started.");
        }
    }
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.