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;
}
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();
}
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;
}
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;
}
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());
}
});
}
Aggregations