Search in sources :

Example 1 with JDKLogger

use of org.identityconnectors.common.logging.impl.JDKLogger in project CzechIdMng by bcvsolutions.

the class IcInitDataProcessor method process.

@Override
public EventResult<ModuleDescriptorDto> process(EntityEvent<ModuleDescriptorDto> event) {
    LOG.info("Initialization [{}] module...", IcModuleDescriptor.MODULE_ID);
    // ConnId using logger implementation, what cannot be configured (printing
    // always). We need change the implementation to JDKLogger.
    // Second way how configuring that property, is create property file
    // 'connectors.properties' in the java home (jre/lib), witch will contains same
    // property.
    System.setProperty(PROPERTY_CONNID_LOGGER_IMPLEMENTATION, JDKLogger.class.getName());
    // VŠ: I had to use this hard code. Because logger in Connid is cached and calls before this initialisation.
    try {
        Method spiClassMethod = Arrays.asList(Log.class.getDeclaredMethods()).stream().filter(propertyDescriptor -> {
            return PROPERTY_SET_LOGGER.equals(propertyDescriptor.getName());
        }).findFirst().orElse(null);
        spiClassMethod.setAccessible(true);
        spiClassMethod.invoke(Log.class, new Object[] { null });
    } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
        throw new CoreException(e);
    }
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : CoreException(eu.bcvsolutions.idm.core.api.exception.CoreException) Log(org.identityconnectors.common.logging.Log) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) JDKLogger(org.identityconnectors.common.logging.impl.JDKLogger) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)1 CoreException (eu.bcvsolutions.idm.core.api.exception.CoreException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 Log (org.identityconnectors.common.logging.Log)1 JDKLogger (org.identityconnectors.common.logging.impl.JDKLogger)1