Package org.apache.sling.commons.log.logback.internal.config

Examples of org.apache.sling.commons.log.logback.internal.config.ConfigurationException


        ServiceReference sr = this.bundleContext
                .getServiceReference(ConfigurationAdmin.class.getName());
        if (sr != null) {
            try {
                if (logLevel == null) {
                    throw new ConfigurationException(LogConfigManager.LOG_LEVEL,
                            "Log level has to be specified.");
                }
                if (loggers == null) {
                    throw new ConfigurationException(LogConfigManager.LOG_LOGGERS,
                            "Logger categories have to be specified.");
                }
                if (logFile == null) {
                    throw new ConfigurationException(LogConfigManager.LOG_FILE,
                            "LogFile name has to be specified.");
                }
                // try to get the configadmin
                final ConfigurationAdmin configAdmin = (ConfigurationAdmin) this.bundleContext
                        .getService(sr);
View Full Code Here


        ServiceReference sr = this.bundleContext
                .getServiceReference(ConfigurationAdmin.class.getName());
        if (sr != null) {
            try {
                if (pid == null) {
                    throw new ConfigurationException(LogConfigManager.PID,
                            "PID has to be specified.");
                }
                // try to get the configadmin
                final ConfigurationAdmin configAdmin = (ConfigurationAdmin) this.bundleContext
                        .getService(sr);
                if (configAdmin != null) {
                    try {
                        Configuration config = configAdmin.getConfiguration(pid);
                        if (config != null) {
                            config.delete();
                        } else {
                            throw new ConfigurationException(LogConfigManager.PID,
                                    "No configuration for this PID:" + pid);
                        }
                    } catch (IOException ioe) {
                        internalFailure(
                                "Cannot delete configuration for pid " + pid,
View Full Code Here

                LogWriter existingWriterByFileName = writerByFileName.get(logFileName);
                if (existingWriterByFileName != null
                    && (oldWriter != null && !existingWriterByFileName.getConfigurationPID().equals(pid))) {

                    // this file is already configured by another LOG_PID
                    throw new ConfigurationException(LogConfigManager.LOG_FILE, "LogFile " + logFileName
                        + " already configured by configuration " + existingWriterByFileName.getConfigurationPID());
                }
            }

            // get number of files and ensure minimum and default
View Full Code Here

                additiv = false;
            }

            // verify categories
            if (categories == null) {
                throw new ConfigurationException(LogConfigManager.LOG_LOGGERS, "Missing categories in configuration "
                    + pid);
            }

            // verify no other configuration has any of the categories
            for (final String cat : categories) {
                final LogConfig cfg = configByCategory.get(cat);
                if (cfg != null && !pid.equals(cfg.getConfigPid())) {
                    throw new ConfigurationException(LogConfigManager.LOG_LOGGERS, "Category " + cat
                        + " already defined by configuration " + pid);
                }
            }

            // verify log level
            if (level == null) {
                throw new ConfigurationException(LogConfigManager.LOG_LEVEL, "Value required");
            }
            // TODO: support numeric levels !
            final Level logLevel = Level.toLevel(level);
            if (logLevel == null) {
                throw new ConfigurationException(LogConfigManager.LOG_LEVEL, "Unsupported value: " + level);
            }

            // verify pattern
            if (pattern == null || pattern.length() == 0) {
                pattern = LogConfigManager.LOG_PATTERN_DEFAULT;
View Full Code Here

TOP

Related Classes of org.apache.sling.commons.log.logback.internal.config.ConfigurationException

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.