mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-07 17:38:32 +08:00
日志优化
This commit is contained in:
parent
b809a0808e
commit
b657be1872
@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory;
|
||||
*
|
||||
*/
|
||||
public class ActiveDirectoryUtils extends LdapUtils {
|
||||
private final static Logger _logger = LoggerFactory.getLogger(ActiveDirectoryUtils.class);
|
||||
private static final Logger _logger = LoggerFactory.getLogger(ActiveDirectoryUtils.class);
|
||||
|
||||
protected String domain;
|
||||
|
||||
@ -87,9 +87,9 @@ public class ActiveDirectoryUtils extends LdapUtils {
|
||||
activeDirectoryDomain = domain;
|
||||
}
|
||||
|
||||
_logger.info("PROVIDER_DOMAIN:" + activeDirectoryDomain + " for " + domain);
|
||||
_logger.info("PROVIDER_DOMAIN : {} for {}" ,activeDirectoryDomain, domain);
|
||||
String activeDirectoryPrincipal = activeDirectoryDomain + "\\" + principal;
|
||||
_logger.debug("Active Directory SECURITY_PRINCIPAL : " + activeDirectoryPrincipal);
|
||||
_logger.debug("Active Directory SECURITY_PRINCIPAL : {}" , activeDirectoryPrincipal);
|
||||
props.setProperty(Context.SECURITY_PRINCIPAL, activeDirectoryPrincipal);
|
||||
props.setProperty(Context.SECURITY_CREDENTIALS, credentials);
|
||||
|
||||
|
||||
@ -108,9 +108,9 @@ public class LdapUtils {
|
||||
DirContext ctx = null;
|
||||
try {
|
||||
ctx = new InitialDirContext(properties);
|
||||
_logger.info("connect to ldap " + providerUrl + " seccessful.");
|
||||
_logger.info("connect to ldap {} seccessful.",providerUrl);
|
||||
} catch (NamingException e) {
|
||||
_logger.error("connect to ldap " + providerUrl + " fail.");
|
||||
_logger.error("connect to ldap {} fail.",providerUrl);
|
||||
_logger.error(e.getMessage());
|
||||
}
|
||||
return ctx;
|
||||
|
||||
@ -41,7 +41,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ActiveDirectoryOrganizationService extends AbstractSynchronizerService implements ISynchronizerService{
|
||||
final static Logger _logger = LoggerFactory.getLogger(ActiveDirectoryOrganizationService.class);
|
||||
static final Logger _logger = LoggerFactory.getLogger(ActiveDirectoryOrganizationService.class);
|
||||
|
||||
ActiveDirectoryUtils ldapUtils;
|
||||
|
||||
@ -61,7 +61,7 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
|
||||
String parentNamePath= organization.getNamePath().substring(0, organization.getNamePath().lastIndexOf("/"));
|
||||
|
||||
if(orgsNamePathMap.get(organization.getNamePath())!=null) {
|
||||
_logger.info("org " + orgsNamePathMap.get(organization.getNamePath()).getNamePath()+" exists.");
|
||||
_logger.info("org {} exists." , orgsNamePathMap.get(organization.getNamePath()).getNamePath());
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
|
||||
organization.setParentId(parentOrg.getId());
|
||||
organization.setParentName(parentOrg.getOrgName());
|
||||
organization.setCodePath(parentOrg.getCodePath()+"/"+organization.getId());
|
||||
_logger.info("parentNamePath " + parentNamePath+" , namePah " + organization.getNamePath());
|
||||
_logger.info("parentNamePath {} , namePah {}" ,parentNamePath, organization.getNamePath());
|
||||
|
||||
//synchro Related
|
||||
SynchroRelated synchroRelated =
|
||||
@ -81,7 +81,7 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
|
||||
if(synchroRelated == null) {
|
||||
organization.setId(organization.generateId());
|
||||
organizationsService.insert(organization);
|
||||
_logger.debug("Organizations : " + organization);
|
||||
_logger.debug("Organizations : {}" , organization);
|
||||
|
||||
synchroRelated = buildSynchroRelated(organization,organization.getLdapDn(),organization.getOrgName());
|
||||
}else {
|
||||
@ -141,7 +141,7 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
|
||||
_logger.debug("Sync OrganizationalUnit {} , name [{}] , NameInNamespace [{}]" ,
|
||||
(++recordCount),sr.getName(),sr.getNameInNamespace());
|
||||
|
||||
HashMap<String,Attribute> attributeMap = new HashMap<String,Attribute>();
|
||||
HashMap<String,Attribute> attributeMap = new HashMap<>();
|
||||
NamingEnumeration<? extends Attribute> attrs = sr.getAttributes().getAll();
|
||||
while (null != attrs && attrs.hasMoreElements()) {
|
||||
Attribute objAttrs = attrs.nextElement();
|
||||
@ -208,7 +208,7 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
|
||||
org.setInstId(this.synchronizer.getInstId());
|
||||
org.setStatus(ConstsStatus.ACTIVE);
|
||||
|
||||
_logger.debug("Organization " + org);
|
||||
_logger.debug("Organization {}" , org);
|
||||
return org;
|
||||
} catch (NamingException e) {
|
||||
_logger.error("NamingException " , e);
|
||||
|
||||
@ -45,8 +45,7 @@ import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
|
||||
@AutoConfiguration
|
||||
public class SynchronizerAutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger =
|
||||
LoggerFactory.getLogger(SynchronizerAutoConfiguration.class);
|
||||
private static final Logger _logger = LoggerFactory.getLogger(SynchronizerAutoConfiguration.class);
|
||||
public static final String SYNCHRONIZERS_SELECT_STATEMENT = "select * from mxk_synchronizers where status ='1'";
|
||||
|
||||
@Bean(name = "schedulerSynchronizerJobs")
|
||||
@ -76,7 +75,7 @@ public class SynchronizerAutoConfiguration implements InitializingBean {
|
||||
Synchronizers synchronizer) throws SchedulerException {
|
||||
JobDetail jobDetail =
|
||||
JobBuilder.newJob(SynchronizerJob.class)
|
||||
.withIdentity(synchronizer.getService()+"Job", "SynchronizerGroups")
|
||||
.withIdentity(synchronizer.getService()+"_Job", "SynchronizerGroups")
|
||||
.build();
|
||||
|
||||
JobDataMap jobDataMap = new JobDataMap();
|
||||
@ -87,7 +86,7 @@ public class SynchronizerAutoConfiguration implements InitializingBean {
|
||||
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(synchronizer.getScheduler());
|
||||
CronTrigger cronTrigger =
|
||||
TriggerBuilder.newTrigger()
|
||||
.withIdentity("trigger"+synchronizer.getService(), "SynchronizerGroups")
|
||||
.withIdentity("trigger_"+synchronizer.getService(), "SynchronizerGroups")
|
||||
.usingJobData(jobDataMap)
|
||||
.withSchedule(scheduleBuilder)
|
||||
.build();
|
||||
@ -106,8 +105,7 @@ public class SynchronizerAutoConfiguration implements InitializingBean {
|
||||
synchronizer.setDriverClass(rs.getString("driverclass"));
|
||||
synchronizer.setPrincipal( rs.getString("principal"));
|
||||
synchronizer.setCredentials(
|
||||
PasswordReciprocal.getInstance().decoder(
|
||||
rs.getString("credentials")));
|
||||
PasswordReciprocal.getInstance().decoder(rs.getString("credentials")));
|
||||
synchronizer.setResumeTime( rs.getString("resumetime"));
|
||||
synchronizer.setSuspendTime(rs.getString("suspendtime"));
|
||||
synchronizer.setUserFilters( rs.getString("userfilters"));
|
||||
|
||||
@ -30,15 +30,15 @@ import org.slf4j.LoggerFactory;
|
||||
public class SynchronizerJob implements Job {
|
||||
static final Logger logger = LoggerFactory.getLogger(SynchronizerJob.class);
|
||||
|
||||
SynchronizersService synchronizersService;
|
||||
|
||||
public static class JOBSTATUS{
|
||||
public static int STOP = 0;
|
||||
public static int RUNNING = 1;
|
||||
public static int FINISHED = 2;
|
||||
public static final int STOP = 0;
|
||||
public static final int RUNNING = 1;
|
||||
public static final int FINISHED = 2;
|
||||
}
|
||||
|
||||
private static HashMap<String,Integer> jobStatus = new HashMap<String,Integer>();
|
||||
SynchronizersService synchronizersService;
|
||||
|
||||
private static HashMap<String,Integer> jobStatus = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user