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

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


        entityManager.remove(logger);
    }

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

        delete(logger);
View Full Code Here


            if (logConf.getLevel() != null) {
                if (syncopeLoggers.containsKey(loggerName)) {
                    logConf.setLevel(syncopeLoggers.get(loggerName).getLevel().getLevel());
                    syncopeLoggers.remove(loggerName);
                } else if (!loggerName.equals(LoggerType.AUDIT.getPrefix())) {
                    SyncopeLogger syncopeLogger = new SyncopeLogger();
                    syncopeLogger.setName(loggerName);
                    syncopeLogger.setLevel(LoggerLevel.fromLevel(logConf.getLevel()));
                    syncopeLogger.setType(loggerName.startsWith(LoggerType.AUDIT.getPrefix())
                            ? LoggerType.AUDIT
                            : LoggerType.LOG);
                    loggerDAO.save(syncopeLogger);
                }
            }
        }

        /*
         * Foreach SyncopeLogger not found in log4j create a new log4j logger with given name and level.
         */
        for (SyncopeLogger syncopeLogger : syncopeLoggers.values()) {
            LoggerConfig logConf = ctx.getConfiguration().getLoggerConfig(syncopeLogger.getName());
            logConf.setLevel(syncopeLogger.getLevel().getLevel());
        }

        ctx.updateLoggers();
    }
View Full Code Here

        } catch (IllegalArgumentException e) {
            LOG.error("Invalid audit parameters, aborting...", e);
        }

        if (auditLoggerName != null) {
            SyncopeLogger syncopeLogger = loggerDAO.find(auditLoggerName.toLoggerName());
            if (syncopeLogger != null && syncopeLogger.getLevel() == LoggerLevel.DEBUG) {
                StringBuilder auditMessage = new StringBuilder();

                final SecurityContext ctx = SecurityContextHolder.getContext();
                if (ctx != null && ctx.getAuthentication() != null) {
                    auditMessage.append('[').append(ctx.getAuthentication().getName()).append(']').append(' ');
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 sce;
    }

    private LoggerTO setLevel(final String name, final Level level, final LoggerType 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(LoggerType.AUDIT.getPrefix())
                    ? LoggerType.AUDIT
                    : LoggerType.LOG);
        }

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

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

        LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
        LoggerConfig logConf = SyncopeConstants.ROOT_LOGGER.equals(name)
                ? ctx.getConfiguration().getLoggerConfig(LogManager.ROOT_LOGGER_NAME)
View Full Code Here

            throw sce;
        }
    }

    private LoggerTO delete(final String name, final LoggerType 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

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.