Package org.apache.syncope.core.persistence.beans

Examples of org.apache.syncope.core.persistence.beans.SyncopeLogger


        throw sccee;
    }

    private LoggerTO setLevel(final String name, final Level level, final SyncopeLoggerType expectedType) {
        SyncopeLogger syncopeLogger = loggerDAO.find(name);
        if (syncopeLogger == null) {
            LOG.debug("Logger {} not found: creating new...", name);

            syncopeLogger = new SyncopeLogger();
            syncopeLogger.setName(name);
            syncopeLogger.setType(name.startsWith(SyncopeLoggerType.AUDIT.getPrefix())
                    ? SyncopeLoggerType.AUDIT
                    : SyncopeLoggerType.LOG);
        }

        if (expectedType != syncopeLogger.getType()) {
            throwInvalidLogger(expectedType);
        }

        syncopeLogger.setLevel(SyncopeLoggerLevel.fromLevel(level));
        syncopeLogger = loggerDAO.save(syncopeLogger);

        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        Logger logger = lc.getLogger(name);
        logger.setLevel(level);
View Full Code Here


            throw sccee;
        }
    }

    private LoggerTO delete(final String name, final SyncopeLoggerType expectedType) throws NotFoundException {
        SyncopeLogger syncopeLogger = loggerDAO.find(name);
        if (syncopeLogger == null) {
            throw new NotFoundException("Logger " + name);
        } else if (expectedType != syncopeLogger.getType()) {
            throwInvalidLogger(expectedType);
        }

        LoggerTO loggerToDelete = new LoggerTO();
        BeanUtils.copyProperties(syncopeLogger, loggerToDelete);
View Full Code Here

            if (logger.getLevel() != null) {
                if (loggerLogs.containsKey(logger.getName())) {
                    logger.setLevel(loggerLogs.get(logger.getName()).getLevel().getLevel());
                    loggerLogs.remove(logger.getName());
                } else if (!logger.getName().equals(SyncopeLoggerType.AUDIT.getPrefix())) {
                    SyncopeLogger syncopeLogger = new SyncopeLogger();
                    syncopeLogger.setName(logger.getName());
                    syncopeLogger.setLevel(SyncopeLoggerLevel.fromLevel(logger.getLevel()));
                    syncopeLogger.setType(logger.getName().startsWith(SyncopeLoggerType.AUDIT.getPrefix())
                            ? SyncopeLoggerType.AUDIT
                            : SyncopeLoggerType.LOG);
                    loggerDAO.save(syncopeLogger);
                }
            }
        }

        /*
         * Foreach SyncopeLogger not found in Logback, create a new Logback logger with given name and level.
         */
        for (SyncopeLogger syncopeLogger : loggerLogs.values()) {
            Logger logger = lc.getLogger(syncopeLogger.getName());
            logger.setLevel(syncopeLogger.getLevel().getLevel());
        }
    }
View Full Code Here

        entityManager.remove(logger);
    }

    @Override
    public void delete(final String name) {
        SyncopeLogger logger = find(name);
        if (logger == null) {
            return;
        }

        delete(logger);
View Full Code Here

        throw sccee;
    }

    private LoggerTO setLevel(final String name, final Level level, final SyncopeLoggerType expectedType) {
        SyncopeLogger syncopeLogger = loggerDAO.find(name);
        if (syncopeLogger == null) {
            LOG.debug("Logger {} not found: creating new...", name);

            syncopeLogger = new SyncopeLogger();
            syncopeLogger.setName(name);
            syncopeLogger.setType(name.startsWith(SyncopeLoggerType.AUDIT.getPrefix())
                    ? SyncopeLoggerType.AUDIT
                    : SyncopeLoggerType.LOG);
        }

        if (expectedType != syncopeLogger.getType()) {
            throwInvalidLogger(expectedType);
        }

        syncopeLogger.setLevel(SyncopeLoggerLevel.fromLevel(level));
        syncopeLogger = loggerDAO.save(syncopeLogger);

        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        Logger logger = lc.getLogger(name);
        logger.setLevel(level);
View Full Code Here

            throw sccee;
        }
    }

    private LoggerTO delete(final String name, final SyncopeLoggerType expectedType) throws NotFoundException {
        SyncopeLogger syncopeLogger = loggerDAO.find(name);
        if (syncopeLogger == null) {
            throw new NotFoundException("Logger " + name);
        } else if (expectedType != syncopeLogger.getType()) {
            throwInvalidLogger(expectedType);
        }

        LoggerTO loggerToDelete = new LoggerTO();
        BeanUtils.copyProperties(syncopeLogger, loggerToDelete);
View Full Code Here

            if (logger.getLevel() != null) {
                if (loggerLogs.containsKey(logger.getName())) {
                    logger.setLevel(loggerLogs.get(logger.getName()).getLevel().getLevel());
                    loggerLogs.remove(logger.getName());
                } else if (!logger.getName().equals(SyncopeLoggerType.AUDIT.getPrefix())) {
                    SyncopeLogger syncopeLogger = new SyncopeLogger();
                    syncopeLogger.setName(logger.getName());
                    syncopeLogger.setLevel(SyncopeLoggerLevel.fromLevel(logger.getLevel()));
                    syncopeLogger.setType(logger.getName().startsWith(SyncopeLoggerType.AUDIT.getPrefix())
                            ? SyncopeLoggerType.AUDIT
                            : SyncopeLoggerType.LOG);
                    loggerDAO.save(syncopeLogger);
                }
            }
        }

        /*
         * Foreach SyncopeLogger not found in Logback, create a new Logback logger with given name and level.
         */
        for (SyncopeLogger syncopeLogger : loggerLogs.values()) {
            Logger logger = lc.getLogger(syncopeLogger.getName());
            logger.setLevel(syncopeLogger.getLevel().getLevel());
        }
    }
View Full Code Here

        throw sccee;
    }

    private LoggerTO setLevel(final String name, final Level level, final SyncopeLoggerType expectedType) {
        SyncopeLogger syncopeLogger = loggerDAO.find(name);
        if (syncopeLogger == null) {
            LOG.debug("Logger {} not found: creating new...", name);

            syncopeLogger = new SyncopeLogger();
            syncopeLogger.setName(name);
            syncopeLogger.setType(name.startsWith(SyncopeLoggerType.AUDIT.getPrefix())
                    ? SyncopeLoggerType.AUDIT
                    : SyncopeLoggerType.LOG);
        }

        if (expectedType != syncopeLogger.getType()) {
            throwInvalidLogger(expectedType);
        }

        syncopeLogger.setLevel(SyncopeLoggerLevel.fromLevel(level));
        syncopeLogger = loggerDAO.save(syncopeLogger);

        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        Logger logger = lc.getLogger(name);
        logger.setLevel(level);
View Full Code Here

            throw sccee;
        }
    }

    private LoggerTO delete(final String name, final SyncopeLoggerType expectedType) throws NotFoundException {
        SyncopeLogger syncopeLogger = loggerDAO.find(name);
        if (syncopeLogger == null) {
            throw new NotFoundException("Logger " + name);
        } else if (expectedType != syncopeLogger.getType()) {
            throwInvalidLogger(expectedType);
        }
       
        LoggerTO loggerToDelete = new LoggerTO();
        BeanUtils.copyProperties(syncopeLogger, loggerToDelete);
View Full Code Here

            if (logger.getLevel() != null) {
                if (loggerLogs.containsKey(logger.getName())) {
                    logger.setLevel(loggerLogs.get(logger.getName()).getLevel().getLevel());
                    loggerLogs.remove(logger.getName());
                } else if (!logger.getName().equals(SyncopeLoggerType.AUDIT.getPrefix())) {
                    SyncopeLogger syncopeLogger = new SyncopeLogger();
                    syncopeLogger.setName(logger.getName());
                    syncopeLogger.setLevel(SyncopeLoggerLevel.fromLevel(logger.getLevel()));
                    syncopeLogger.setType(logger.getName().startsWith(SyncopeLoggerType.AUDIT.getPrefix())
                            ? SyncopeLoggerType.AUDIT
                            : SyncopeLoggerType.LOG);
                    loggerDAO.save(syncopeLogger);
                }
            }
        }

        /*
         * Foreach SyncopeLogger not found in Logback, create a new Logback logger with given name and level.
         */
        for (SyncopeLogger syncopeLogger : loggerLogs.values()) {
            Logger logger = lc.getLogger(syncopeLogger.getName());
            logger.setLevel(syncopeLogger.getLevel().getLevel());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.SyncopeLogger

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.