Search in sources :

Example 6 with ClassLoggerConfigurationType

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

the class SystemConfigurationDto method getNewObject.

public SystemConfigurationType getNewObject() throws DatatypeConfigurationException {
    SystemConfigurationType newObject = oldObject.clone();
    if (StringUtils.isNotBlank(getPassPolicyDto().getOid())) {
        ObjectReferenceType globalPassPolicyRef = ObjectTypeUtil.createObjectRef(getPassPolicyDto().getOid(), ObjectTypes.PASSWORD_POLICY);
        newObject.setGlobalPasswordPolicyRef(globalPassPolicyRef);
    } else {
        newObject.setGlobalPasswordPolicyRef(null);
    }
    if (StringUtils.isNotBlank(getSecurityPolicyDto().getOid())) {
        ObjectReferenceType globalSecurityPolicyRef = ObjectTypeUtil.createObjectRef(getSecurityPolicyDto().getOid(), WebComponentUtil.createPolyFromOrigString(getSecurityPolicyDto().getName()), ObjectTypes.SECURITY_POLICY);
        newObject.setGlobalSecurityPolicyRef(globalSecurityPolicyRef);
    } else {
        newObject.setGlobalSecurityPolicyRef(null);
    }
    AssignmentPolicyEnforcementType globalAEP = AEPlevel.toAEPValueType(getAepLevel());
    if (globalAEP != null) {
        ProjectionPolicyType projectionPolicy = new ProjectionPolicyType();
        projectionPolicy.setAssignmentPolicyEnforcement(globalAEP);
        newObject.setGlobalAccountSynchronizationSettings(projectionPolicy);
    }
    Duration auditCleanupDuration = DatatypeFactory.newInstance().newDuration(getAuditCleanupValue());
    Duration cleanupTaskDuration = DatatypeFactory.newInstance().newDuration(getTaskCleanupValue());
    CleanupPolicyType auditCleanup = new CleanupPolicyType();
    CleanupPolicyType taskCleanup = new CleanupPolicyType();
    auditCleanup.setMaxAge(auditCleanupDuration);
    taskCleanup.setMaxAge(cleanupTaskDuration);
    CleanupPoliciesType cleanupPolicies = new CleanupPoliciesType();
    cleanupPolicies.setAuditRecords(auditCleanup);
    cleanupPolicies.setClosedTasks(taskCleanup);
    newObject.setCleanupPolicy(cleanupPolicies);
    SystemConfigurationTypeUtil.setEnableExperimentalCode(newObject, getEnableExperimentalCode());
    newObject.setLogging(loggingConfig.getNewObject());
    newObject.setNotificationConfiguration(notificationConfig.getNewObject(newObject));
    newObject.setProfilingConfiguration(profilingDto.getNewObject());
    ClassLoggerConfigurationType profilingClassLogger = profilingDto.getProfilingClassLogerConfig();
    if (newObject.getLogging() != null) {
        newObject.getLogging().getClassLogger().add(profilingClassLogger);
    } else {
        LoggingConfigurationType profLogging = new LoggingConfigurationType();
        profLogging.getClassLogger().add(profilingClassLogger);
        newObject.setLogging(profLogging);
    }
    return newObject;
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) CleanupPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.CleanupPolicyType) LoggingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType) AssignmentPolicyEnforcementType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType) CleanupPoliciesType(com.evolveum.midpoint.xml.ns._public.common.common_3.CleanupPoliciesType) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) Duration(javax.xml.datatype.Duration) ClassLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType) ProjectionPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionPolicyType)

Example 7 with ClassLoggerConfigurationType

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

the class TestLoggingConfiguration method test021JulLoggingEnabled.

@Test
public void test021JulLoggingEnabled() throws Exception {
    final String TEST_NAME = "test021JulLoggingEnabled";
    TestUtil.displayTestTile(TEST_NAME);
    // GIVEN
    LogfileTestTailer tailer = new LogfileTestTailer(LoggingConfigurationManager.AUDIT_LOGGER_NAME);
    java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger(JUL_LOGGER_NAME);
    Task task = taskManager.createTaskInstance(TestLoggingConfiguration.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    // Setup
    PrismObject<SystemConfigurationType> systemConfiguration = PrismTestUtil.parseObject(AbstractInitializedModelIntegrationTest.SYSTEM_CONFIGURATION_FILE);
    LoggingConfigurationType logging = systemConfiguration.asObjectable().getLogging();
    applyTestLoggingConfig(logging);
    ClassLoggerConfigurationType classLogerCongif = new ClassLoggerConfigurationType();
    classLogerCongif.setPackage(JUL_LOGGER_NAME);
    classLogerCongif.setLevel(LoggingLevelType.ALL);
    logging.getClassLogger().add(classLogerCongif);
    ObjectDelta<SystemConfigurationType> systemConfigDelta = ObjectDelta.createModificationReplaceProperty(SystemConfigurationType.class, AbstractInitializedModelIntegrationTest.SYSTEM_CONFIGURATION_OID, SystemConfigurationType.F_LOGGING, prismContext, logging);
    Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(systemConfigDelta);
    modelService.executeChanges(deltas, null, task, result);
    // WHEN
    julLogger.severe(LogfileTestTailer.MARKER + " JULsevere");
    julLogger.warning(LogfileTestTailer.MARKER + " JULwarning");
    julLogger.info(LogfileTestTailer.MARKER + " JULinfo");
    julLogger.fine(LogfileTestTailer.MARKER + " JULfine");
    julLogger.finer(LogfileTestTailer.MARKER + " JULfiner");
    julLogger.finest(LogfileTestTailer.MARKER + " JULfinest");
    tailer.tail();
    tailer.assertMarkerLogged(LogfileTestTailer.LEVEL_ERROR, "JULsevere");
    tailer.assertMarkerLogged(LogfileTestTailer.LEVEL_WARN, "JULwarning");
    tailer.assertMarkerLogged(LogfileTestTailer.LEVEL_INFO, "JULinfo");
    tailer.assertMarkerLogged(LogfileTestTailer.LEVEL_DEBUG, "JULfine");
    tailer.assertMarkerLogged(LogfileTestTailer.LEVEL_DEBUG, "JULfiner");
    tailer.assertMarkerLogged(LogfileTestTailer.LEVEL_TRACE, "JULfinest");
    tailer.close();
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ClassLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) LoggingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta) Test(org.testng.annotations.Test)

Example 8 with ClassLoggerConfigurationType

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

the class ClassLogger method toXmlType.

public ClassLoggerConfigurationType toXmlType() {
    ClassLoggerConfigurationType type = new ClassLoggerConfigurationType();
    type.setPackage(_package);
    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 9 with ClassLoggerConfigurationType

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

the class ComponentLogger method toXmlType.

public ClassLoggerConfigurationType toXmlType() {
    ClassLoggerConfigurationType type = new ClassLoggerConfigurationType();
    type.setPackage(getPackageByValue(component));
    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 10 with ClassLoggerConfigurationType

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

the class LoggingDto method init.

private void init(LoggingConfigurationType config) {
    if (config == null) {
        return;
    }
    rootLevel = config.getRootLoggerLevel();
    rootAppender = config.getRootLoggerAppender();
    for (SubSystemLoggerConfigurationType logger : config.getSubSystemLogger()) {
        filters.add(new FilterConfiguration(logger));
    }
    AuditingConfigurationType auditing = config.getAuditing();
    if (auditing != null) {
        setAuditLog(auditing.isEnabled());
        setAuditDetails(auditing.isDetails());
        setAuditAppender(auditing.getAppender() != null && auditing.getAppender().size() > 0 ? auditing.getAppender().get(0) : null);
    }
    for (ClassLoggerConfigurationType logger : config.getClassLogger()) {
        if (ProfilingDto.LOGGER_PROFILING.equals(logger.getPackage())) {
            continue;
        }
        if (componentMap.containsKey(logger.getPackage())) {
            loggers.add(new ComponentLogger(logger));
        } else if (StandardLogger.isStandardLogger(logger.getPackage())) {
            loggers.add(new StandardLogger(logger));
        } else {
            loggers.add(new ClassLogger(logger));
        }
    }
    Collections.sort(loggers, new Comparator<LoggerConfiguration>() {

        @Override
        public int compare(LoggerConfiguration l1, LoggerConfiguration l2) {
            return String.CASE_INSENSITIVE_ORDER.compare(l1.getName(), l2.getName());
        }
    });
    Collections.sort(filters, new Comparator<FilterConfiguration>() {

        @Override
        public int compare(FilterConfiguration f1, FilterConfiguration f2) {
            return String.CASE_INSENSITIVE_ORDER.compare(f1.getName(), f2.getName());
        }
    });
}
Also used : AuditingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuditingConfigurationType) 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