Search in sources :

Example 11 with ClassLoggerConfigurationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType in project midpoint by Evolveum.

the class LoggingDto method getNewObject.

public LoggingConfigurationType getNewObject() {
    LoggingConfigurationType configuration = new LoggingConfigurationType();
    AuditingConfigurationType audit = new AuditingConfigurationType();
    audit.setEnabled(isAuditLog());
    audit.setDetails(isAuditDetails());
    if (StringUtils.isNotEmpty(getAuditAppender())) {
        audit.getAppender().add(getAuditAppender());
    }
    configuration.setAuditing(audit);
    configuration.setRootLoggerAppender(getRootAppender());
    configuration.setRootLoggerLevel(getRootLevel());
    for (AppenderConfiguration item : getAppenders()) {
        configuration.getAppender().add(item.getConfig());
    }
    for (LoggerConfiguration item : getLoggers()) {
        for (ClassLoggerConfigurationType logger : configuration.getClassLogger()) {
            if (logger.getPackage().equals(item.getName())) {
                throw new IllegalStateException("Logger with name '" + item.getName() + "' is already defined.");
            }
        }
        //TODO : clean up toXmlType() method.. getAppenders() in LogginConfiguration is empty by default..shouldn't it be null?
        if (item.toXmlType() != null) {
            configuration.getClassLogger().add(item.toXmlType());
        }
    }
    for (FilterConfiguration item : getFilters()) {
        for (SubSystemLoggerConfigurationType filter : configuration.getSubSystemLogger()) {
            if (filter.getComponent().name().equals(item.getName())) {
                throw new IllegalStateException("Filter with name '" + item.getName() + "' is already defined.");
            }
        }
        configuration.getSubSystemLogger().add(item.toXmlType());
    }
    for (LoggerConfiguration logger : getLoggers()) {
        logger.setEditing(false);
    }
    for (FilterConfiguration filter : getFilters()) {
        filter.setEditing(false);
    }
    for (AppenderConfiguration appender : getAppenders()) {
        appender.setEditing(false);
    }
    return configuration;
}
Also used : AuditingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuditingConfigurationType) LoggingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType) ClassLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType) SubSystemLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SubSystemLoggerConfigurationType)

Example 12 with ClassLoggerConfigurationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType in project midpoint by Evolveum.

the class StandardLogger method toXmlType.

public ClassLoggerConfigurationType toXmlType() {
    ClassLoggerConfigurationType type = new ClassLoggerConfigurationType();
    type.setPackage(logger.getValue());
    type.setLevel(getLevel());
    if (!(getAppenders().isEmpty())) {
        type.getAppender().addAll(getAppenders());
    }
    return type;
}
Also used : ClassLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType)

Example 13 with ClassLoggerConfigurationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType in project midpoint by Evolveum.

the class SystemConfigurationDto method init.

private void init(SystemConfigurationType config) {
    if (config == null) {
        return;
    }
    if (config.getGlobalAccountSynchronizationSettings() != null) {
        AssignmentPolicyEnforcementType globalAEP = config.getGlobalAccountSynchronizationSettings().getAssignmentPolicyEnforcement();
        aepLevel = AEPlevel.fromAEPLevelType(globalAEP);
    }
    CleanupPolicyType auditCleanup = config.getCleanupPolicy().getAuditRecords();
    CleanupPolicyType taskCleanup = config.getCleanupPolicy().getClosedTasks();
    auditCleanupValue = auditCleanup.getMaxAge().toString();
    taskCleanupValue = taskCleanup.getMaxAge().toString();
    passPolicyDto = loadPasswordPolicy(config);
    securityPolicyDto = loadSecurityPolicy(config);
    objectPolicyList = new ArrayList<>();
    List<ObjectPolicyConfigurationType> objectPolicies = config.getDefaultObjectPolicyConfiguration();
    if (objectPolicies != null && !objectPolicies.isEmpty()) {
        for (ObjectPolicyConfigurationType policy : objectPolicies) {
            objectPolicyList.add(new ObjectPolicyConfigurationTypeDto(policy));
        }
    } else {
        objectPolicyList.add(new ObjectPolicyConfigurationTypeDto());
    }
    // NOTIFICATIONS
    if (config.getNotificationConfiguration() != null) {
        notificationConfig = new NotificationConfigurationDto(config.getNotificationConfiguration());
    } else {
        notificationConfig = new NotificationConfigurationDto();
    }
    // LOGGING
    LoggingConfigurationType logging = config.getLogging();
    if (logging != null) {
        for (AppenderConfigurationType appender : logging.getAppender()) {
            if (appender instanceof FileAppenderConfigurationType) {
                appenders.add(new FileAppenderConfig((FileAppenderConfigurationType) appender));
            } else {
                appenders.add(new AppenderConfiguration(appender));
            }
        }
        Collections.sort(appenders);
        loggingConfig = new LoggingDto(config.getLogging());
    } else {
        loggingConfig = new LoggingDto();
    }
    loggingConfig.setAppenders(appenders);
    // PROFILING
    if (config.getProfilingConfiguration() != null) {
        List<ClassLoggerConfigurationType> classLoggerConfig = config.getLogging() != null ? config.getLogging().getClassLogger() : null;
        profilingDto = new ProfilingDto(config.getProfilingConfiguration(), classLoggerConfig);
    } else {
        profilingDto = new ProfilingDto();
    }
    profilingDto.setAppenders(appenders);
    enableExperimentalCode = SystemConfigurationTypeUtil.isExperimentalCodeEnabled(config);
    userDashboardLink = loadUserDashboardLink(config);
    additionalMenuLink = loadAdditionalMenuItem(config);
}
Also used : CleanupPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.CleanupPolicyType) AssignmentPolicyEnforcementType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType) ClassLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType) FileAppenderConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.FileAppenderConfigurationType) FileAppenderConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.FileAppenderConfigurationType) AppenderConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.AppenderConfigurationType) ObjectPolicyConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectPolicyConfigurationType) LoggingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType)

Example 14 with ClassLoggerConfigurationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType in project midpoint by Evolveum.

the class LoggingConfigPanel method addStandardLoggerPerformed.

private void addStandardLoggerPerformed(AjaxRequestTarget target) {
    LoggingDto dto = getModel().getObject();
    StandardLogger logger = new StandardLogger(new ClassLoggerConfigurationType());
    logger.setEditing(true);
    dto.getLoggers().add(logger);
    TablePanel loggersTable = getLoggersTable();
    adjustLoggersTablePage(loggersTable, dto);
    target.add(getLoggersTable());
}
Also used : StandardLogger(com.evolveum.midpoint.web.page.admin.configuration.dto.StandardLogger) ClassLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType) LoggingDto(com.evolveum.midpoint.web.page.admin.configuration.dto.LoggingDto) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 15 with ClassLoggerConfigurationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType in project midpoint by Evolveum.

the class LoggingConfigurationManager method prepareConfiguration.

private static String prepareConfiguration(LoggingConfigurationType config) throws SchemaException {
    if (null == config) {
        throw new IllegalArgumentException("Configuration can't be null");
    }
    StringBuilder sb = new StringBuilder();
    sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
    sb.append("<configuration scan=\"false\" debug=\"true\">\n");
    //find and configure ALL logger and bring it to top of turbo stack
    for (SubSystemLoggerConfigurationType ss : config.getSubSystemLogger()) {
        if ("ALL".contentEquals(ss.getComponent().name())) {
            defineTurbo(sb, ss);
        }
    }
    //Generate subsystem logging quickstep
    for (SubSystemLoggerConfigurationType ss : config.getSubSystemLogger()) {
        if (null == ss.getComponent() || null == ss.getLevel()) {
            LOGGER.error("Subsystem ({}) or level ({})is null", ss.getComponent(), ss.getLevel());
            continue;
        }
        //skip disabled subsystem logger
        if ("OFF".equals(ss.getLevel().name())) {
            continue;
        }
        //All ready defined above
        if ("ALL".contentEquals(ss.getComponent().name())) {
            continue;
        }
        defineTurbo(sb, ss);
    }
    //Generate appenders configuration
    for (AppenderConfigurationType appender : config.getAppender()) {
        prepareAppenderConfiguration(sb, appender, config);
    }
    //define root appender if defined
    if (!StringUtils.isEmpty(config.getRootLoggerAppender())) {
        sb.append("\t<root level=\"");
        sb.append(config.getRootLoggerLevel());
        sb.append("\">\n");
        sb.append("\t\t<appender-ref ref=\"");
        sb.append(config.getRootLoggerAppender());
        sb.append("\" />\n");
        sb.append("\t</root>\n");
    }
    //Generate class based loggers
    for (ClassLoggerConfigurationType logger : config.getClassLogger()) {
        sb.append("\t<logger name=\"");
        sb.append(logger.getPackage());
        sb.append("\" level=\"");
        sb.append(logger.getLevel());
        sb.append("\"");
        //if logger specific appender is defined
        if (null != logger.getAppender() && !logger.getAppender().isEmpty()) {
            sb.append(" additivity=\"false\">\n");
            for (String appenderName : logger.getAppender()) {
                sb.append("\t\t<appender-ref ref=\"");
                sb.append(appenderName);
                sb.append("\"/>");
            }
            sb.append("\t</logger>\n");
        } else {
            sb.append("/>\n");
        }
    }
    generateAuditingLogConfig(config.getAuditing(), sb);
    if (null != config.getAdvanced()) {
        for (Object item : config.getAdvanced().getContent()) {
            sb.append(item.toString());
            sb.append("\n");
        }
    }
    // LevelChangePropagator to propagate log level changes to JUL
    // this keeps us from performance impact of disable JUL logging statements
    // WARNING: if deployed in Tomcat then this propagates only to the JUL loggers in current classloader.
    // It means that ICF connector loggers are not affected by this
    // MAGIC: moved to the end of the "file" as suggested in http://jira.qos.ch/browse/LOGBACK-740
    sb.append("\t<contextListener class=\"ch.qos.logback.classic.jul.LevelChangePropagator\">\n");
    sb.append("\t\t<resetJUL>true</resetJUL>\n");
    sb.append("\t</contextListener>\n");
    sb.append("</configuration>");
    return sb.toString();
}
Also used : SyslogAppenderConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SyslogAppenderConfigurationType) FileAppenderConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.FileAppenderConfigurationType) AppenderConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.AppenderConfigurationType) ClassLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType) SubSystemLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SubSystemLoggerConfigurationType)

Aggregations

ClassLoggerConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType)17 LoggingConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType)5 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)3 LoggingDto (com.evolveum.midpoint.web.page.admin.configuration.dto.LoggingDto)3 SubSystemLoggerConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SubSystemLoggerConfigurationType)3 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)3 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 Task (com.evolveum.midpoint.task.api.Task)2 LogfileTestTailer (com.evolveum.midpoint.test.util.LogfileTestTailer)2 AppenderConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.AppenderConfigurationType)2 AssignmentPolicyEnforcementType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType)2 AuditingConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.AuditingConfigurationType)2 CleanupPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.CleanupPolicyType)2 FileAppenderConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.FileAppenderConfigurationType)2 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)2 Test (org.testng.annotations.Test)2 DummyConnector (com.evolveum.icf.dummy.connector.DummyConnector)1 IntegrationTestTools (com.evolveum.midpoint.test.IntegrationTestTools)1 ClassLogger (com.evolveum.midpoint.web.page.admin.configuration.dto.ClassLogger)1