summaryrefslogtreecommitdiffstats
path: root/integrity-monitor/src
diff options
context:
space:
mode:
Diffstat (limited to 'integrity-monitor/src')
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java152
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java26
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java16
-rw-r--r--integrity-monitor/src/main/resources/META-INF/persistence.xml53
-rw-r--r--integrity-monitor/src/test/resources/logback-test.xml47
5 files changed, 137 insertions, 157 deletions
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
index a921b3ea..79eeee49 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed 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.
@@ -20,11 +20,13 @@
package org.onap.policy.common.im;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +41,7 @@ public class StateTransition {
public static final String AVAILABLE_STATUS = "availStatus";
public static final String STANDBY_STATUS = "standbyStatus";
public static final String ACTOIN_NAME = "actionName";
-
+
/*
* Common strings.
*/
@@ -49,33 +51,39 @@ public class StateTransition {
private static final String STANDBY_STRING = "], standbyStatus=[";
private static final String ACTION_STRING = "], actionName=[";
- private HashMap<String, String> stateTable = new HashMap<>();
+ /*
+ * Valid values for each type.
+ */
+ private static final Set<String> VALID_ADMIN_STATE = Collections
+ .unmodifiableSet(new HashSet<>(Arrays.asList(StateManagement.LOCKED, StateManagement.UNLOCKED)));
+
+ private static final Set<String> VALID_OP_STATE = Collections
+ .unmodifiableSet(new HashSet<>(Arrays.asList(StateManagement.ENABLED, StateManagement.DISABLED)));
+
+ private static final Set<String> VALID_STANDBY_STATUS = Collections.unmodifiableSet(
+ new HashSet<>(Arrays.asList(StateManagement.NULL_VALUE, StateManagement.COLD_STANDBY,
+ StateManagement.HOT_STANDBY, StateManagement.PROVIDING_SERVICE)));
+
+ private static final Set<String> VALID_AVAIL_STATUS = Collections
+ .unmodifiableSet(new HashSet<>(Arrays.asList(StateManagement.NULL_VALUE, StateManagement.DEPENDENCY,
+ StateManagement.DEPENDENCY_FAILED, StateManagement.FAILED)));
+
+ private static final Set<String> VALID_ACTION_NAME =
+ Collections.unmodifiableSet(new HashSet<>(Arrays.asList(StateManagement.DEMOTE,
+ StateManagement.DISABLE_DEPENDENCY, StateManagement.DISABLE_FAILED,
+ StateManagement.ENABLE_NO_DEPENDENCY, StateManagement.ENABLE_NOT_FAILED,
+ StateManagement.LOCK, StateManagement.PROMOTE, StateManagement.UNLOCK)));
+
/**
- * StateTransition constructor.
- *
- * @throws StateTransitionException if an error occurs
+ * State-transition table.
*/
- public StateTransition() throws StateTransitionException {
- if (logger.isDebugEnabled()) {
- logger.debug("StateTransition constructor");
- }
-
- try {
- if (logger.isDebugEnabled()) {
- logger.debug("Load StateTable started");
- }
+ private static final Map<String, String> STATE_TABLE = Collections.unmodifiableMap(makeStateTable());
- setupStateTable();
- } catch (Exception ex) {
- logger.error("StateTransition threw exception.", ex);
- throw new StateTransitionException("StateTransition Exception: " + ex.toString());
- }
- }
/**
* Calculates the state transition and returns the end state.
- *
+ *
* @param adminState the administration state
* @param opState the operational state
* @param availStatus the availability status
@@ -86,54 +94,30 @@ public class StateTransition {
*/
public StateElement getEndingState(String adminState, String opState, String availStatus, String standbyStatus,
String actionName) throws StateTransitionException {
- if (logger.isDebugEnabled()) {
- logger.debug("getEndingState");
- }
- if (logger.isDebugEnabled()) {
- logger.debug("adminState=[{}], opState=[{}], availStatus=[{}], standbyStatus=[{}], actionName[{}]",
- adminState, opState, availStatus, standbyStatus, actionName);
- }
+ logger.debug("getEndingState");
+ logger.debug("adminState=[{}], opState=[{}], availStatus=[{}], standbyStatus=[{}], actionName[{}]",
+ adminState, opState, availStatus, standbyStatus, actionName);
if (availStatus == null) {
- availStatus = "null";
+ availStatus = StateManagement.NULL_VALUE;
}
if (standbyStatus == null) {
- standbyStatus = "null";
+ standbyStatus = StateManagement.NULL_VALUE;
}
- if (adminState == null || opState == null || actionName == null) {
- throw new StateTransitionException(EXCEPTION_STRING
- + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING
- + standbyStatus + ACTION_STRING + actionName + "]");
- } else if (!(adminState.equals(StateManagement.LOCKED) || adminState.equals(StateManagement.UNLOCKED))) {
- throw new StateTransitionException(EXCEPTION_STRING
- + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING
- + standbyStatus + ACTION_STRING + actionName + "]");
- } else if (!(opState.equals(StateManagement.ENABLED) || opState.equals(StateManagement.DISABLED))) {
- throw new StateTransitionException(EXCEPTION_STRING
- + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING
- + standbyStatus + ACTION_STRING + actionName + "]");
- } else if (!(standbyStatus.equals(StateManagement.NULL_VALUE)
- || standbyStatus.equals(StateManagement.COLD_STANDBY)
- || standbyStatus.equals(StateManagement.HOT_STANDBY)
- || standbyStatus.equals(StateManagement.PROVIDING_SERVICE))) {
- throw new StateTransitionException(EXCEPTION_STRING
- + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING
- + standbyStatus + ACTION_STRING + actionName + "]");
- } else if (!(availStatus.equals(StateManagement.NULL_VALUE) || availStatus.equals(StateManagement.DEPENDENCY)
- || availStatus.equals(StateManagement.DEPENDENCY_FAILED)
- || availStatus.equals(StateManagement.FAILED))) {
- throw new StateTransitionException(EXCEPTION_STRING
- + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING
- + standbyStatus + ACTION_STRING + actionName + "]");
- } else if (!(actionName.equals(StateManagement.DEMOTE) || actionName.equals(StateManagement.DISABLE_DEPENDENCY)
- || actionName.equals(StateManagement.DISABLE_FAILED)
- || actionName.equals(StateManagement.ENABLE_NO_DEPENDENCY)
- || actionName.equals(StateManagement.ENABLE_NOT_FAILED) || actionName.equals(StateManagement.LOCK)
- || actionName.equals(StateManagement.PROMOTE) || actionName.equals(StateManagement.UNLOCK))) {
- throw new StateTransitionException(EXCEPTION_STRING
- + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus + STANDBY_STRING
- + standbyStatus + ACTION_STRING + actionName + "]");
+
+ if (!VALID_ADMIN_STATE.contains(adminState) || !VALID_OP_STATE.contains(opState)
+ || !VALID_STANDBY_STATUS.contains(standbyStatus)) {
+ throw new StateTransitionException(
+ EXCEPTION_STRING + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus
+ + STANDBY_STRING + standbyStatus + ACTION_STRING + actionName + "]");
}
+ if (!VALID_AVAIL_STATUS.contains(availStatus) || !VALID_ACTION_NAME.contains(actionName)) {
+ throw new StateTransitionException(
+ EXCEPTION_STRING + adminState + OPSTATE_STRING + opState + AVAILSTATUS_STRING + availStatus
+ + STANDBY_STRING + standbyStatus + ACTION_STRING + actionName + "]");
+ }
+
+
StateElement stateElement = new StateElement();
try {
// dependency,failed is stored as dependency.failed in StateTable
@@ -145,7 +129,7 @@ public class StateTransition {
if (logger.isDebugEnabled()) {
logger.debug("Ending State search key: {}", key);
}
- String value = stateTable.get(key);
+ String value = STATE_TABLE.get(key);
if (value != null) {
try {
@@ -189,7 +173,7 @@ public class StateTransition {
* endingAdminState,endingOpState,endingAvailStatus,endingStandbyStatus,exception Note : Use
* period instead of comma as seperator when store multi-value endingStandbyStatus (convert to
* comma during retrieval)
- *
+ *
* <p>Note on illegal state/status combinations: This table has many state/status combinations
* that should never occur. However, they *may* occur due to corruption or manual manipulation
* of the DB. So, in each case of an illegal combination, the state/status is first corrected
@@ -199,18 +183,18 @@ public class StateTransition {
* availability status is left null until a disabledfailed or disableddependency action is
* received. Or, if a enableNotFailed or enableNoDependency is received while the availability
* status is null, it will remain null, but the Operational state will change to enabled.
- *
+ *
* <p>If the standby status is not in agreement with the administrative and/or operational
* states, it is brought into agreement. For example, if the administrative state is locked and
* the standby status is providingservice, the standby status is changed to coldstandby.
- *
+ *
* <p>After bringing the states/status attributes into agreement, *then* the action is applied
* to them. For example, if the administrative state is locked, the operational state is
* enabled, the availability status is null, the standby status is providingservice and the
* action is unlock, the standby status is changed to coldstandby and then the unlock action is
* applied. This will change the final state/status to administrative state = unlocked,
* operational state = disabled, availability status = null and standby status = hotstandby.
- *
+ *
* <p>Note on standby status: If the starting state of standby status is null and either a
* promote or demote action is made, the assumption is that standbystatus is supported and
* therefore, the standby status will be changed to providingservice, hotstandby or coldstandby
@@ -221,9 +205,13 @@ public class StateTransition {
* operational state such that they are unlocked and enabled, the standby status is
* automatically transitioned to hotstandby since it is only those two states that can hold the
* statndby status in the coldstandby value.
+ *
+ * @return a new state-transaction table
*/
- private void setupStateTable() {
+ private static Map<String, String> makeStateTable() {
+ Map<String,String> stateTable = new HashMap<>();
+
stateTable.put("unlocked,enabled,null,null,lock", "locked,enabled,null,null,");
stateTable.put("unlocked,enabled,null,null,unlock", "unlocked,enabled,null,null,");
stateTable.put("unlocked,enabled,null,null,disableFailed", "unlocked,disabled,failed,null,");
@@ -934,21 +922,21 @@ public class StateTransition {
"locked,disabled,dependency.failed,coldstandby,StandbyStatusException");
stateTable.put("locked,disabled,dependency.failed,providingservice,demote",
"locked,disabled,dependency.failed,coldstandby,");
+
+ return stateTable;
}
/**
* Display the state table.
*/
public void displayStateTable() {
- Set<?> set = stateTable.entrySet();
- Iterator<?> iter = set.iterator();
+ if (!logger.isDebugEnabled()) {
+ return;
+ }
- while (iter.hasNext()) {
- Map.Entry<?, ?> me = (Map.Entry<?, ?>) iter.next();
- String key = (String) me.getKey() + ((String) me.getValue()).replace(".", ",");
- if (logger.isDebugEnabled()) {
- logger.debug("{}", key);
- }
+ for (Entry<String, String> me : STATE_TABLE.entrySet()) {
+ String key = me.getKey() + me.getValue().replace(".", ",");
+ logger.debug("{}", key);
}
}
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java
index b71751f0..a2d8c091 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed 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.
@@ -23,15 +23,11 @@ package org.onap.policy.common.im.jmx;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-
import javax.management.MBeanServerConnection;
-import javax.management.Notification;
-import javax.management.NotificationListener;
import javax.management.remote.JMXConnectionNotification;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
-
import org.onap.policy.common.im.IntegrityMonitorException;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
@@ -66,7 +62,7 @@ public final class JmxAgentConnection {
/**
* Generate jmxAgent url. service:jmx:rmi:///jndi/rmi://host.domain:9999/jmxAgent
- *
+ *
* @param host host.domain
* @param port 9999
* @return jmxAgent url.
@@ -78,7 +74,7 @@ public final class JmxAgentConnection {
/**
* Get a connection to the jmxAgent MBeanServer.
- *
+ *
* @return the connection
* @throws IntegrityMonitorException on error
*/
@@ -95,14 +91,10 @@ public final class JmxAgentConnection {
connector = JMXConnectorFactory.newJMXConnector(url, env);
connector.connect();
- connector.addConnectionNotificationListener(new NotificationListener() {
-
- @Override
- public void handleNotification(Notification notification, Object handback) {
- if (notification.getType().equals(JMXConnectionNotification.FAILED)) {
- // handle disconnect
- disconnect();
- }
+ connector.addConnectionNotificationListener((notification, handback) -> {
+ if (notification.getType().equals(JMXConnectionNotification.FAILED)) {
+ // handle disconnect
+ disconnect();
}
}, null, null);
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java
index 78b90abd..79f843e4 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed 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.
@@ -73,6 +73,10 @@ public class StateManagementEntity implements Serializable {
@Column(name = "modifiedDate", nullable = false)
private Date modifiedDate;
+ public StateManagementEntity() {
+ // default constructor
+ }
+
@PrePersist
public void prePersist() {
this.createdDate = MonitorTime.getInstance().getDate();
@@ -84,10 +88,6 @@ public class StateManagementEntity implements Serializable {
this.modifiedDate = MonitorTime.getInstance().getDate();
}
- public StateManagementEntity() {
- // default constructor
- }
-
public String getResourceName() {
return this.resourceName;
}
@@ -135,7 +135,7 @@ public class StateManagementEntity implements Serializable {
/**
* Clone a StateManagementEntity.
- *
+ *
* @param sm the StateManagementEntity to clone
* @return a new StateManagementEntity
*/
diff --git a/integrity-monitor/src/main/resources/META-INF/persistence.xml b/integrity-monitor/src/main/resources/META-INF/persistence.xml
index f5089b12..7aff9219 100644
--- a/integrity-monitor/src/main/resources/META-INF/persistence.xml
+++ b/integrity-monitor/src/main/resources/META-INF/persistence.xml
@@ -3,14 +3,14 @@
============LICENSE_START=======================================================
Integrity Monitor
================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed 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.
@@ -19,30 +19,31 @@
============LICENSE_END=========================================================
-->
-<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
- <persistence-unit name="schemaPU" transaction-type="RESOURCE_LOCAL">
- <!-- Limited use for generating the DB and schema files for imtest DB - uses eclipselink -->
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.onap.policy.common.im.jpa.ImTestEntity</class>
- <class>org.onap.policy.common.im.jpa.StateManagementEntity</class>
- <class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class>
- <class>org.onap.policy.common.im.jpa.ResourceRegistrationEntity</class>
- <shared-cache-mode>NONE</shared-cache-mode>
- <properties>
- <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
+<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
+ <persistence-unit name="schemaPU" transaction-type="RESOURCE_LOCAL">
+ <!-- Limited use for generating the DB and schema files for imtest DB - uses eclipselink -->
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.onap.policy.common.im.jpa.ImTestEntity</class>
+ <class>org.onap.policy.common.im.jpa.StateManagementEntity</class>
+ <class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class>
+ <class>org.onap.policy.common.im.jpa.ResourceRegistrationEntity</class>
+ <shared-cache-mode>NONE</shared-cache-mode>
+ <properties>
+ <property name="javax.persistence.schema-generation.database.action" value="drop-and-create" />
</properties>
- </persistence-unit>
+ </persistence-unit>
- <persistence-unit name="operationalPU" transaction-type="RESOURCE_LOCAL">
- <!-- For operational use -->
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.onap.policy.common.im.jpa.ImTestEntity</class>
- <class>org.onap.policy.common.im.jpa.StateManagementEntity</class>
- <class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class>
- <class>org.onap.policy.common.im.jpa.ResourceRegistrationEntity</class>
- <shared-cache-mode>NONE</shared-cache-mode>
- <properties>
- <!-- none -->
+ <persistence-unit name="operationalPU" transaction-type="RESOURCE_LOCAL">
+ <!-- For operational use -->
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.onap.policy.common.im.jpa.ImTestEntity</class>
+ <class>org.onap.policy.common.im.jpa.StateManagementEntity</class>
+ <class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class>
+ <class>org.onap.policy.common.im.jpa.ResourceRegistrationEntity</class>
+ <shared-cache-mode>NONE</shared-cache-mode>
+ <properties>
+ <!-- none -->
</properties>
- </persistence-unit>
+ </persistence-unit>
</persistence>
diff --git a/integrity-monitor/src/test/resources/logback-test.xml b/integrity-monitor/src/test/resources/logback-test.xml
index 57a9d1c9..70a71950 100644
--- a/integrity-monitor/src/test/resources/logback-test.xml
+++ b/integrity-monitor/src/test/resources/logback-test.xml
@@ -2,14 +2,14 @@
============LICENSE_START=======================================================
integrity-monitor
================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed 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.
@@ -22,26 +22,25 @@
<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <Pattern>
- %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M\(%line\) - %msg%n
- </Pattern>
- </encoder>
- </appender>
- <appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <file>logs/debug.log</file>
- <encoder>
- <Pattern>
- %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M\(%line\) - %msg%n
- </Pattern>
- </encoder>
- </appender>
-
- <root level="debug">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="FILE" />
- </root>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <Pattern>
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M\(%line\) - %msg%n
+ </Pattern>
+ </encoder>
+ </appender>
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>logs/debug.log</file>
+ <encoder>
+ <Pattern>
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M\(%line\) - %msg%n
+ </Pattern>
+ </encoder>
+ </appender>
-</configuration>
+ <root level="debug">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="FILE" />
+ </root>
+</configuration>