forked from community/device-mgt-core
Merge branch 'master' of ssh://repository.entgra.net:222/community/device-mgt-core into syncHierarchicalGrouping
commit
74b2e183b0
@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||
*
|
||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package io.entgra.device.mgt.core.notification.logger;
|
||||
|
||||
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||
|
||||
public class AppInstallLogContext extends LogContext {
|
||||
private final String appId;
|
||||
private final String appName;
|
||||
private final String appType;
|
||||
private final String subType;
|
||||
private final String tenantId;
|
||||
private final String tenantDomain;
|
||||
private final String device;
|
||||
private final String userName;
|
||||
private final String action;
|
||||
|
||||
private AppInstallLogContext(Builder builder) {
|
||||
this.appId = builder.appId;
|
||||
this.appName = builder.appName;
|
||||
this.appType = builder.appType;
|
||||
this.subType = builder.subType;
|
||||
this.tenantId = builder.tenantId;
|
||||
this.tenantDomain = builder.tenantDomain;
|
||||
this.device = builder.device;
|
||||
this.userName = builder.userName;
|
||||
this.action = builder.action;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
public String getAppType() {
|
||||
return appType;
|
||||
}
|
||||
|
||||
public String getSubType() {
|
||||
return subType;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public String getTenantDomain() {
|
||||
return tenantDomain;
|
||||
}
|
||||
|
||||
public String getDevice() {
|
||||
return device;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String appId;
|
||||
private String appName;
|
||||
private String appType;
|
||||
private String subType;
|
||||
private String tenantId;
|
||||
private String tenantDomain;
|
||||
private String device;
|
||||
private String userName;
|
||||
private String action;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public Builder setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public Builder setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
public Builder setAppName(String appName) {
|
||||
this.appName = appName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAppType() {
|
||||
return appType;
|
||||
}
|
||||
|
||||
public Builder setAppType(String appType) {
|
||||
this.appType = appType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSubType() {
|
||||
return subType;
|
||||
}
|
||||
|
||||
public Builder setSubType(String subType) {
|
||||
this.subType = subType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTenantDomain() {
|
||||
return tenantDomain;
|
||||
}
|
||||
|
||||
public Builder setTenantDomain(String tenantDomain) {
|
||||
this.tenantDomain = tenantDomain;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public Builder setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDevice() {
|
||||
return device;
|
||||
}
|
||||
|
||||
public Builder setDevice(String device) {
|
||||
this.device = device;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public Builder setAction(String action) {
|
||||
this.action = action;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AppInstallLogContext build() {
|
||||
return new AppInstallLogContext(this);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||
*
|
||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package io.entgra.device.mgt.core.notification.logger;
|
||||
|
||||
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||
|
||||
public class DeviceConnectivityLogContext extends LogContext {
|
||||
|
||||
private final String deviceId;
|
||||
private final String deviceType;
|
||||
private final String actionTag;
|
||||
private final String operationCode;
|
||||
private final String tenantId;
|
||||
private final String tenantDomain;
|
||||
private final String userName;
|
||||
|
||||
private DeviceConnectivityLogContext(Builder builder) {
|
||||
this.deviceId = builder.deviceId;
|
||||
this.deviceType = builder.deviceType;
|
||||
this.actionTag = builder.actionTag;
|
||||
this.operationCode = builder.operationCode;
|
||||
this.tenantId = builder.tenantId;
|
||||
this.tenantDomain = builder.tenantDomain;
|
||||
this.userName = builder.userName;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public String getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public String getActionTag() {
|
||||
return actionTag;
|
||||
}
|
||||
|
||||
public String getOperationCode() {
|
||||
return operationCode;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public String getTenantDomain() {
|
||||
return tenantDomain;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String deviceId;
|
||||
private String deviceType;
|
||||
private String operationCode;
|
||||
private String actionTag;
|
||||
private String tenantId;
|
||||
private String tenantDomain;
|
||||
private String userName;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public Builder setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public Builder setDeviceType(String deviceType) {
|
||||
this.deviceType = deviceType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOperationCode() {
|
||||
return operationCode;
|
||||
}
|
||||
|
||||
public Builder setOperationCode(String operationCode) {
|
||||
this.operationCode = operationCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public Builder setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTenantDomain() {
|
||||
return tenantDomain;
|
||||
}
|
||||
|
||||
public Builder setTenantDomain(String tenantDomain) {
|
||||
this.tenantDomain = tenantDomain;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public Builder setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getActionTag() {
|
||||
return actionTag;
|
||||
}
|
||||
|
||||
public Builder setActionTag(String actionTag) {
|
||||
this.actionTag = actionTag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DeviceConnectivityLogContext build() {
|
||||
return new DeviceConnectivityLogContext(this);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||
*
|
||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package io.entgra.device.mgt.core.notification.logger;
|
||||
|
||||
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||
|
||||
public class DeviceEnrolmentLogContext extends LogContext {
|
||||
private final String deviceId;
|
||||
private final String deviceType;
|
||||
private final String owner;
|
||||
private final String ownership;
|
||||
private final String tenantID;
|
||||
private final String tenantDomain;
|
||||
private final String userName;
|
||||
|
||||
private DeviceEnrolmentLogContext(Builder builder) {
|
||||
this.deviceId = builder.deviceId;
|
||||
this.deviceType = builder.deviceType;
|
||||
this.owner = builder.owner;
|
||||
this.ownership = builder.ownership;
|
||||
this.tenantID = builder.tenantID;
|
||||
this.tenantDomain = builder.tenantDomain;
|
||||
this.userName = builder.userName;
|
||||
}
|
||||
|
||||
public String getTenantID() {
|
||||
return tenantID;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public String getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public String getOwnership() {
|
||||
return ownership;
|
||||
}
|
||||
|
||||
public String getTenantDomain() {
|
||||
return tenantDomain;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
public static class Builder {
|
||||
private String deviceId;
|
||||
private String deviceType;
|
||||
private String owner;
|
||||
private String ownership;
|
||||
private String tenantID;
|
||||
private String tenantDomain;
|
||||
private String userName;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public String getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public Builder setDeviceType(String deviceType) {
|
||||
this.deviceType = deviceType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTenantID() {
|
||||
return tenantID;
|
||||
}
|
||||
|
||||
public Builder setTenantID(String tenantID) {
|
||||
this.tenantID = tenantID;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTenantDomain() {
|
||||
return tenantDomain;
|
||||
}
|
||||
|
||||
public Builder setTenantDomain(String tenantDomain) {
|
||||
this.tenantDomain = tenantDomain;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public Builder setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public Builder setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public Builder setOwner(String owner) {
|
||||
this.owner = owner;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOwnership() {
|
||||
return ownership;
|
||||
}
|
||||
|
||||
public Builder setOwnership(String ownership) {
|
||||
this.ownership = ownership;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DeviceEnrolmentLogContext build() {
|
||||
return new DeviceEnrolmentLogContext(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||
*
|
||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package io.entgra.device.mgt.core.notification.logger;
|
||||
|
||||
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||
|
||||
public class PolicyLogContext extends LogContext {
|
||||
private final String policyName;
|
||||
private final String payload;
|
||||
private final String actionTag;
|
||||
private final String userName;
|
||||
private final String tenantID;
|
||||
private final String tenantDomain;
|
||||
|
||||
private PolicyLogContext(Builder builder) {
|
||||
this.policyName = builder.policyName;
|
||||
this.payload = builder.payload;
|
||||
this.actionTag = builder.actionTag;
|
||||
this.userName = builder.userName;
|
||||
this.tenantID = builder.tenantID;
|
||||
this.tenantDomain = builder.tenantDomain;
|
||||
}
|
||||
|
||||
public String getPolicyName() {
|
||||
return policyName;
|
||||
}
|
||||
|
||||
public String getPayload() {
|
||||
return payload;
|
||||
}
|
||||
|
||||
public String getActionTag() {
|
||||
return actionTag;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public String getTenantID() {
|
||||
return tenantID;
|
||||
}
|
||||
|
||||
public String getTenantDomain() {
|
||||
return tenantDomain;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String policyName;
|
||||
private String payload;
|
||||
private String actionTag;
|
||||
private String userName;
|
||||
private String tenantID;
|
||||
private String tenantDomain;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public String getPolicyName() {
|
||||
return policyName;
|
||||
}
|
||||
|
||||
public Builder setPolicyName(String policyName) {
|
||||
this.policyName = policyName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPayload() {
|
||||
return payload;
|
||||
}
|
||||
|
||||
public Builder setPayload(String payload) {
|
||||
this.payload = payload;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getActionTag() {
|
||||
return actionTag;
|
||||
}
|
||||
|
||||
public Builder setActionTag(String actionTag) {
|
||||
this.actionTag = actionTag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public Builder setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTenantID() {
|
||||
return tenantID;
|
||||
}
|
||||
|
||||
public Builder setTenantID(String tenantID) {
|
||||
this.tenantID = tenantID;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTenantDomain() {
|
||||
return tenantDomain;
|
||||
}
|
||||
|
||||
public Builder setTenantDomain(String tenantDomain) {
|
||||
this.tenantDomain = tenantDomain;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PolicyLogContext build() {
|
||||
return new PolicyLogContext(this);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,318 @@
|
||||
/*
|
||||
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||
*
|
||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.entgra.device.mgt.core.notification.logger.impl;
|
||||
|
||||
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||
import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
|
||||
import io.entgra.device.mgt.core.notification.logger.AppInstallLogContext;
|
||||
import io.entgra.device.mgt.core.notification.logger.util.MDCContextUtil;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.log4j.MDC;
|
||||
|
||||
public class EntgraAppInstallLoggerImpl implements EntgraLogger {
|
||||
|
||||
private static Log log = null;
|
||||
|
||||
public EntgraAppInstallLoggerImpl(Class<?> clazz) {
|
||||
log = LogFactory.getLog(clazz);
|
||||
}
|
||||
|
||||
public void info(String message) {
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
public void info(String message, Throwable t) {
|
||||
log.info(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object o) {
|
||||
log.info(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object o, Throwable throwable) {
|
||||
log.info(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(String message, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object object, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.info(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object object, Throwable t, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.info(object, t);
|
||||
}
|
||||
|
||||
public void debug(String message) {
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
public void debug(String message, Throwable t) {
|
||||
log.debug(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object o) {
|
||||
log.debug(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object o, Throwable throwable) {
|
||||
log.debug(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(String message, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object object, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.debug(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object object, Throwable t, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.debug(object, t);
|
||||
}
|
||||
|
||||
public void error(String message) {
|
||||
log.error(message);
|
||||
}
|
||||
|
||||
public void error(String message, Throwable t) {
|
||||
log.error(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object o) {
|
||||
log.error(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object o, Throwable throwable) {
|
||||
log.error(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String message, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.error(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String message, Throwable t, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.error(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object object, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.error(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object object, Throwable t, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.error(object, t);
|
||||
}
|
||||
|
||||
public void warn(String message) {
|
||||
log.warn(message);
|
||||
}
|
||||
|
||||
public void warn(String message, Throwable t) {
|
||||
log.warn(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object o) {
|
||||
log.warn(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object o, Throwable throwable) {
|
||||
log.warn(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(String message, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.warn(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(String message, Throwable t, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.warn(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object object, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.warn(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object object, Throwable t, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.warn(object, t);
|
||||
}
|
||||
|
||||
public void trace(String message) {
|
||||
log.trace(message);
|
||||
}
|
||||
|
||||
public void trace(String message, Throwable t) {
|
||||
log.trace(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object o) {
|
||||
log.trace(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object o, Throwable throwable) {
|
||||
log.trace(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(String message, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.trace(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object object, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.trace(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object object, Throwable t, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.trace(object, t);
|
||||
}
|
||||
|
||||
public void fatal(String message) {
|
||||
log.fatal(message);
|
||||
}
|
||||
|
||||
public void fatal(String message, Throwable t) {
|
||||
log.fatal(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object o) {
|
||||
log.fatal(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object o, Throwable throwable) {
|
||||
log.fatal(0, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(String message, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.fatal(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object object, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.fatal(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object object, Throwable t, LogContext logContext) {
|
||||
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||
log.fatal(object, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDebugEnabled() {
|
||||
return log.isDebugEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isErrorEnabled() {
|
||||
return log.isErrorEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFatalEnabled() {
|
||||
return log.isFatalEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInfoEnabled() {
|
||||
return log.isInfoEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTraceEnabled() {
|
||||
return log.isTraceEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWarnEnabled() {
|
||||
return log.isWarnEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearLogContext() {
|
||||
MDC.clear();
|
||||
}
|
||||
}
|
@ -0,0 +1,318 @@
|
||||
/*
|
||||
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||
*
|
||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.entgra.device.mgt.core.notification.logger.impl;
|
||||
|
||||
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||
import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
|
||||
import io.entgra.device.mgt.core.notification.logger.DeviceConnectivityLogContext;
|
||||
import io.entgra.device.mgt.core.notification.logger.util.MDCContextUtil;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.log4j.MDC;
|
||||
|
||||
public class EntgraDeviceConnectivityLoggerImpl implements EntgraLogger {
|
||||
|
||||
private static Log log = null;
|
||||
|
||||
public EntgraDeviceConnectivityLoggerImpl(Class<?> clazz) {
|
||||
log = LogFactory.getLog(clazz);
|
||||
}
|
||||
|
||||
public void info(String message) {
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
public void info(String message, Throwable t) {
|
||||
log.info(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object o) {
|
||||
log.info(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object o, Throwable throwable) {
|
||||
log.info(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(String message, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object object, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.info(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object object, Throwable t, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.info(object, t);
|
||||
}
|
||||
|
||||
public void debug(String message) {
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
public void debug(String message, Throwable t) {
|
||||
log.debug(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object o) {
|
||||
log.debug(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object o, Throwable throwable) {
|
||||
log.debug(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(String message, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object object, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.debug(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object object, Throwable t, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.debug(object, t);
|
||||
}
|
||||
|
||||
public void error(String message) {
|
||||
log.error(message);
|
||||
}
|
||||
|
||||
public void error(String message, Throwable t) {
|
||||
log.error(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object o) {
|
||||
log.error(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object o, Throwable throwable) {
|
||||
log.error(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String message, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.error(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String message, Throwable t, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.error(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object object, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.error(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object object, Throwable t, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.error(object, t);
|
||||
}
|
||||
|
||||
public void warn(String message) {
|
||||
log.warn(message);
|
||||
}
|
||||
|
||||
public void warn(String message, Throwable t) {
|
||||
log.warn(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object o) {
|
||||
log.warn(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object o, Throwable throwable) {
|
||||
log.warn(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(String message, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.warn(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(String message, Throwable t, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.warn(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object object, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.warn(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object object, Throwable t, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.warn(object, t);
|
||||
}
|
||||
|
||||
public void trace(String message) {
|
||||
log.trace(message);
|
||||
}
|
||||
|
||||
public void trace(String message, Throwable t) {
|
||||
log.trace(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object o) {
|
||||
log.trace(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object o, Throwable throwable) {
|
||||
log.trace(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(String message, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.trace(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object object, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.trace(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object object, Throwable t, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.trace(object, t);
|
||||
}
|
||||
|
||||
public void fatal(String message) {
|
||||
log.fatal(message);
|
||||
}
|
||||
|
||||
public void fatal(String message, Throwable t) {
|
||||
log.fatal(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object o) {
|
||||
log.fatal(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object o, Throwable throwable) {
|
||||
log.fatal(0, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(String message, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.fatal(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object object, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.fatal(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object object, Throwable t, LogContext logContext) {
|
||||
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||
log.fatal(object, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDebugEnabled() {
|
||||
return log.isDebugEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isErrorEnabled() {
|
||||
return log.isErrorEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFatalEnabled() {
|
||||
return log.isFatalEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInfoEnabled() {
|
||||
return log.isInfoEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTraceEnabled() {
|
||||
return log.isTraceEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWarnEnabled() {
|
||||
return log.isWarnEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearLogContext() {
|
||||
MDC.clear();
|
||||
}
|
||||
}
|
@ -0,0 +1,318 @@
|
||||
/*
|
||||
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||
*
|
||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.entgra.device.mgt.core.notification.logger.impl;
|
||||
|
||||
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||
import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
|
||||
import io.entgra.device.mgt.core.notification.logger.DeviceEnrolmentLogContext;
|
||||
import io.entgra.device.mgt.core.notification.logger.util.MDCContextUtil;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.log4j.MDC;
|
||||
|
||||
public class EntgraDeviceEnrolmentLoggerImpl implements EntgraLogger {
|
||||
|
||||
private static Log log = null;
|
||||
|
||||
public EntgraDeviceEnrolmentLoggerImpl(Class<?> clazz) {
|
||||
log = LogFactory.getLog(clazz);
|
||||
}
|
||||
|
||||
public void info(String message) {
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
public void info(String message, Throwable t) {
|
||||
log.info(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object o) {
|
||||
log.info(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object o, Throwable throwable) {
|
||||
log.info(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(String message, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object object, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.info(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object object, Throwable t, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.info(object, t);
|
||||
}
|
||||
|
||||
public void debug(String message) {
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
public void debug(String message, Throwable t) {
|
||||
log.debug(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object o) {
|
||||
log.debug(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object o, Throwable throwable) {
|
||||
log.debug(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(String message, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object object, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.debug(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object object, Throwable t, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.debug(object, t);
|
||||
}
|
||||
|
||||
public void error(String message) {
|
||||
log.error(message);
|
||||
}
|
||||
|
||||
public void error(String message, Throwable t) {
|
||||
log.error(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object o) {
|
||||
log.error(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object o, Throwable throwable) {
|
||||
log.error(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String message, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.error(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String message, Throwable t, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.error(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object object, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.error(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object object, Throwable t, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.error(object, t);
|
||||
}
|
||||
|
||||
public void warn(String message) {
|
||||
log.warn(message);
|
||||
}
|
||||
|
||||
public void warn(String message, Throwable t) {
|
||||
log.warn(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object o) {
|
||||
log.warn(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object o, Throwable throwable) {
|
||||
log.warn(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(String message, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.warn(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(String message, Throwable t, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.warn(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object object, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.warn(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object object, Throwable t, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.warn(object, t);
|
||||
}
|
||||
|
||||
public void trace(String message) {
|
||||
log.trace(message);
|
||||
}
|
||||
|
||||
public void trace(String message, Throwable t) {
|
||||
log.trace(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object o) {
|
||||
log.trace(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object o, Throwable throwable) {
|
||||
log.trace(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(String message, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.trace(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object object, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.trace(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object object, Throwable t, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.trace(object, t);
|
||||
}
|
||||
|
||||
public void fatal(String message) {
|
||||
log.fatal(message);
|
||||
}
|
||||
|
||||
public void fatal(String message, Throwable t) {
|
||||
log.fatal(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object o) {
|
||||
log.fatal(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object o, Throwable throwable) {
|
||||
log.fatal(0, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(String message, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.fatal(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object object, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.fatal(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object object, Throwable t, LogContext logContext) {
|
||||
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||
log.fatal(object, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDebugEnabled() {
|
||||
return log.isDebugEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isErrorEnabled() {
|
||||
return log.isErrorEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFatalEnabled() {
|
||||
return log.isFatalEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInfoEnabled() {
|
||||
return log.isInfoEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTraceEnabled() {
|
||||
return log.isTraceEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWarnEnabled() {
|
||||
return log.isWarnEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearLogContext() {
|
||||
MDC.clear();
|
||||
}
|
||||
}
|
@ -0,0 +1,318 @@
|
||||
/*
|
||||
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||
*
|
||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.entgra.device.mgt.core.notification.logger.impl;
|
||||
|
||||
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||
import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
|
||||
import io.entgra.device.mgt.core.notification.logger.PolicyLogContext;
|
||||
import io.entgra.device.mgt.core.notification.logger.util.MDCContextUtil;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.log4j.MDC;
|
||||
|
||||
public class EntgraPolicyLoggerImpl implements EntgraLogger {
|
||||
|
||||
private static Log log = null;
|
||||
|
||||
public EntgraPolicyLoggerImpl(Class<?> clazz) {
|
||||
log = LogFactory.getLog(clazz);
|
||||
}
|
||||
|
||||
public void info(String message) {
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
public void info(String message, Throwable t) {
|
||||
log.info(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object o) {
|
||||
log.info(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object o, Throwable throwable) {
|
||||
log.info(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(String message, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object object, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.info(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(Object object, Throwable t, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.info(object, t);
|
||||
}
|
||||
|
||||
public void debug(String message) {
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
public void debug(String message, Throwable t) {
|
||||
log.debug(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object o) {
|
||||
log.debug(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object o, Throwable throwable) {
|
||||
log.debug(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(String message, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object object, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.debug(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(Object object, Throwable t, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.debug(object, t);
|
||||
}
|
||||
|
||||
public void error(String message) {
|
||||
log.error(message);
|
||||
}
|
||||
|
||||
public void error(String message, Throwable t) {
|
||||
log.error(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object o) {
|
||||
log.error(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object o, Throwable throwable) {
|
||||
log.error(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String message, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.error(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String message, Throwable t, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.error(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object object, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.error(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Object object, Throwable t, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.error(object, t);
|
||||
}
|
||||
|
||||
public void warn(String message) {
|
||||
log.warn(message);
|
||||
}
|
||||
|
||||
public void warn(String message, Throwable t) {
|
||||
log.warn(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object o) {
|
||||
log.warn(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object o, Throwable throwable) {
|
||||
log.warn(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(String message, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.warn(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(String message, Throwable t, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.warn(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object object, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.warn(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(Object object, Throwable t, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.warn(object, t);
|
||||
}
|
||||
|
||||
public void trace(String message) {
|
||||
log.trace(message);
|
||||
}
|
||||
|
||||
public void trace(String message, Throwable t) {
|
||||
log.trace(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object o) {
|
||||
log.trace(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object o, Throwable throwable) {
|
||||
log.trace(o, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(String message, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.trace(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object object, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.trace(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(Object object, Throwable t, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.trace(object, t);
|
||||
}
|
||||
|
||||
public void fatal(String message) {
|
||||
log.fatal(message);
|
||||
}
|
||||
|
||||
public void fatal(String message, Throwable t) {
|
||||
log.fatal(message, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object o) {
|
||||
log.fatal(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object o, Throwable throwable) {
|
||||
log.fatal(0, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(String message, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.fatal(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object object, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.fatal(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(Object object, Throwable t, LogContext logContext) {
|
||||
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||
log.fatal(object, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDebugEnabled() {
|
||||
return log.isDebugEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isErrorEnabled() {
|
||||
return log.isErrorEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFatalEnabled() {
|
||||
return log.isFatalEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInfoEnabled() {
|
||||
return log.isInfoEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTraceEnabled() {
|
||||
return log.isTraceEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWarnEnabled() {
|
||||
return log.isWarnEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearLogContext() {
|
||||
MDC.clear();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue