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