From a8618399833e9e2c2cfdd214058234a1395f8361 Mon Sep 17 00:00:00 2001 From: Kishore Reddy Dwaram Date: Fri, 25 Sep 2020 16:45:02 -0400 Subject: changes done to support logs format Issue-ID: PORTAL-1008 Signed-off-by: Kishore Reddy Dwaram Change-Id: I20f110c0fd48d7258f86f08501bad81244d3db20 --- .../epsdk-app-os/src/main/resources/logback.xml | 43 ++++----- .../webapp/ngapp/src/app/admin/admin.module.ts | 5 +- .../org/onap/portalsdk/core/conf/AppConfig.java | 3 +- .../core/logging/aspect/EELFLoggerAdvice.java | 8 +- .../onap/portalsdk/core/util/SystemProperties.java | 4 +- .../core/logging/logic/EELFLoggerDelegateTest.java | 5 +- ecomp-sdk/epsdk-logger/pom.xml | 39 +++++--- .../core/logging/format/AlarmSeverityEnum.java | 1 + .../core/logging/logic/EELFLoggerDelegate.java | 85 ++++++++++++---- .../core/logging/logic/LoggerProperties.java | 107 +++++++++++++++++---- 10 files changed, 210 insertions(+), 90 deletions(-) diff --git a/ecomp-sdk/epsdk-app-os/src/main/resources/logback.xml b/ecomp-sdk/epsdk-app-os/src/main/resources/logback.xml index 3274c359..0c8ff5b1 100644 --- a/ecomp-sdk/epsdk-app-os/src/main/resources/logback.xml +++ b/ecomp-sdk/epsdk-app-os/src/main/resources/logback.xml @@ -48,6 +48,9 @@ + + + @@ -78,7 +81,7 @@ value="%X{MetricsLogBeginTimestamp}|%X{MetricsLogEndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{ClientIPAddress}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{TargetVisualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}| %msg%n" /> + value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{AlertSeverity}|%X{ErrorCode}|%X{ErrorDescription}| %msg%n" /> @@ -339,33 +342,27 @@ 256 - + + + + + - + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/admin.module.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/admin.module.ts index ba546647..57554de5 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/admin.module.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/admin.module.ts @@ -20,9 +20,10 @@ import {RoleFunctionsComponent} from './role-functions/role-functions.component' import {RolesComponent} from './roles/roles.component'; import {NewRoleComponent} from './roles/new-role/new-role.component' import { UserService } from '../shared/services/user/user.service'; +import { InformationModalComponent } from '../modals/information-modal/information-modal.component'; @NgModule({ - declarations: [AdminComponent, CacheAdminComponent, RoleFunctionsComponent, RolesComponent, NewRoleComponent], + declarations: [AdminComponent, CacheAdminComponent, RoleFunctionsComponent, RolesComponent, NewRoleComponent, InformationModalComponent], imports: [ CommonModule, MenusModule, @@ -38,7 +39,7 @@ import { UserService } from '../shared/services/user/user.service'; MatPaginatorModule, MatInputModule ], - entryComponents: [NewRoleComponent], + entryComponents: [NewRoleComponent, InformationModalComponent], exports: [ ], providers: [UserService] diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java index b1a0b0b8..cc0fca29 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java @@ -112,8 +112,7 @@ public class AppConfig extends WebMvcConfigurerAdapter implements Configurable, * each log file type that logging has been started. */ private void initGlobalLocalContext() { - String appName = SystemProperties.getProperty(SystemProperties.APPLICATION_NAME); - logger.init(appName); + logger.init(); } /** diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java index 6a5fe469..8e21fd2c 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java @@ -37,7 +37,6 @@ */ package org.onap.portalsdk.core.logging.aspect; -import static com.att.eelf.configuration.Configuration.MDC_INSTANCE_UUID; import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN; import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS; import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME; @@ -50,8 +49,6 @@ import java.util.UUID; import javax.servlet.http.HttpServletRequest; import org.onap.portalsdk.core.domain.User; -import org.onap.portalsdk.core.exception.SessionExpiredException; -import org.onap.portalsdk.core.logging.format.AlarmSeverityEnum; import org.onap.portalsdk.core.logging.format.AuditLogFormatter; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.logging.logic.LoggerProperties; @@ -113,10 +110,9 @@ public class EELFLoggerAdvice { } // Initialize Request defaults only for controller methods. - MDC.put(MDC_SERVICE_NAME, SystemProperties.getProperty(SystemProperties.APPLICATION_NAME)); + MDC.put(MDC_SERVICE_NAME, LoggerProperties.getPropertyValue(LoggerProperties.APP_NAME)); MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName()); MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress()); - MDC.put(MDC_INSTANCE_UUID, LoggerProperties.getProperty(LoggerProperties.INSTANCE_UUID)); MDC.put(className + methodName + SystemProperties.METRICSLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC()); MDC.put(SystemProperties.METRICSLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC()); MDC.put(SystemProperties.AUDITLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC()); @@ -207,7 +203,7 @@ public class EELFLoggerAdvice { if (MDC.get(SystemProperties.PARTNER_NAME) == null|| MDC.get(SystemProperties.PARTNER_NAME).isEmpty()){ MDC.put(SystemProperties.PARTNER_NAME, "Unknown"); } - MDC.put(MDC_SERVICE_NAME, SystemProperties.getProperty(SystemProperties.APPLICATION_NAME)); + MDC.put(MDC_SERVICE_NAME, LoggerProperties.getPropertyValue(LoggerProperties.APP_NAME)); MDC.put(SystemProperties.STATUS_CODE, result); diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/util/SystemProperties.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/util/SystemProperties.java index 0ce15b77..d3827d95 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/util/SystemProperties.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/util/SystemProperties.java @@ -347,8 +347,8 @@ public class SystemProperties { * * @return Application name */ - public static String getApplicationName() { - return getProperty(APPLICATION_NAME); + public String getApplicationName() { + return getProperty(APPLICATION_NAME); } /** diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegateTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegateTest.java index 2d1187f9..0d0bea73 100644 --- a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegateTest.java +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegateTest.java @@ -241,9 +241,8 @@ public class EELFLoggerDelegateTest { @Test public void initTest(){ EELFLoggerDelegate eelFLoggerDelegate = new EELFLoggerDelegate(getClass().getName()); - String appName = "PortalSDK"; - eelFLoggerDelegate.init(appName); - Assert.assertTrue(true); + eelFLoggerDelegate.init(); + Assert.assertTrue(true); } @Test diff --git a/ecomp-sdk/epsdk-logger/pom.xml b/ecomp-sdk/epsdk-logger/pom.xml index e5a3a373..0a4ac842 100644 --- a/ecomp-sdk/epsdk-logger/pom.xml +++ b/ecomp-sdk/epsdk-logger/pom.xml @@ -1,20 +1,22 @@ - - 4.0.0 + + 4.0.0 - + org.onap.portal.sdk epsdk-project 3.4.0-SNAPSHOT - - - org.onap.portal.sdk - epsdk-logger - 3.4.0-SNAPSHOT + - ONAP Portal SDK Logger - - - + org.onap.portal.sdk + epsdk-logger + 3.4.0-SNAPSHOT + + ONAP Portal SDK Logger + + + com.att.eelf eelf-core 1.0.0 @@ -24,5 +26,16 @@ javax.servlet-api 3.1.0 - + + org.springframework + spring-core + ${springframework.version} + + + commons-logging + commons-logging + + + + diff --git a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java index 2eda82b0..80dbabde 100644 --- a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java +++ b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java @@ -42,6 +42,7 @@ public enum AlarmSeverityEnum { MAJOR("2"), MINOR("3"), INFORMATIONAL("4"), + ERROR("5"), NONE("0"); private final String severity; diff --git a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java index adad5caa..45eae6d4 100644 --- a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java +++ b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java @@ -38,7 +38,6 @@ package org.onap.portalsdk.core.logging.logic; import static com.att.eelf.configuration.Configuration.MDC_ALERT_SEVERITY; -import static com.att.eelf.configuration.Configuration.MDC_INSTANCE_UUID; import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID; import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN; import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS; @@ -60,7 +59,6 @@ import org.onap.portalsdk.core.logging.format.AppMessagesEnum; import org.onap.portalsdk.core.logging.format.ErrorSeverityEnum; import org.slf4j.MDC; -import com.att.eelf.configuration.Configuration; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.att.eelf.configuration.SLF4jWrapper; @@ -115,17 +113,39 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { public void logWrite(EELFLogger logger, Level level, String msg, Throwable th, Object... arguments) { MDC.put(LoggerProperties.MDC_CLASS_NAME, className); setGlobalLoggingContext(); + String requestId = null; + if (MDC.get(MDC_KEY_REQUEST_ID) == null||MDC.get(MDC_KEY_REQUEST_ID).isEmpty()){ + requestId = UUID.randomUUID().toString(); + MDC.put(MDC_KEY_REQUEST_ID, requestId); + } + if ( logger == errorLogger) { - MDC.put(LoggerProperties.MDC_CLASS_NAME, className); - MDC.put("ErrorCategory", ErrorSeverityEnum.ERROR.name()); - MDC.put("ErrorCode", "900"); - MDC.put("ErrorDescription", "Exception"); + if(MDC.get(LoggerProperties.MDC_CLASS_NAME) == null) { + MDC.put(LoggerProperties.MDC_CLASS_NAME, className); + } + MDC.put(MDC_ALERT_SEVERITY, AlarmSeverityEnum.ERROR.name()); + if(MDC.get(LoggerProperties.ERROR_CODE) == null) { + MDC.put(LoggerProperties.ERROR_CODE, "900"); + } + if(MDC.get(LoggerProperties.ERROR_DESCRIPTION) == null) { + MDC.put(LoggerProperties.ERROR_DESCRIPTION, "Exception"); + } } - if (MDC.get(Configuration.MDC_KEY_REQUEST_ID) == null||MDC.get(Configuration.MDC_KEY_REQUEST_ID).isEmpty()){ - String requestId = UUID.randomUUID().toString(); - MDC.put(Configuration.MDC_KEY_REQUEST_ID, requestId); + if(MDC.get(LoggerProperties.PARTNER_NAME) == null) { + MDC.put(LoggerProperties.PARTNER_NAME, "UNKNOWN"); + } + + if(MDC.get(LoggerProperties.STATUS_CODE) == null) { + MDC.put(LoggerProperties.STATUS_CODE, "COMPLETE"); + } + + if ( logger == auditLogger) { + MDC.put(LoggerProperties.MDC_CLASS_NAME, className); + this.calculateDateTimeDifference(MDC.get(LoggerProperties.AUDITLOG_BEGIN_TIMESTAMP), MDC.get(LoggerProperties.AUDITLOG_END_TIMESTAMP)); + MDC.put(LoggerProperties.CUSTOM_FIELD1, "EXIT"); + MDC.put(LoggerProperties.CUSTOM_FIELD2, "InvocationID=" + requestId); } if (logger.isErrorEnabled()) { @@ -135,12 +155,18 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { } if ( logger == errorLogger) { - MDC.remove(MDC_SERVICE_NAME); MDC.remove(LoggerProperties.MDC_CLASS_NAME); - MDC.remove("ErrorCode"); - MDC.remove("ErrorDescription"); - MDC.remove("ErrorCategory"); + MDC.remove(LoggerProperties.ERROR_CATAGORY); + MDC.remove(LoggerProperties.ERROR_CODE); + MDC.remove(LoggerProperties.ERROR_DESCRIPTION); } + + if(logger == auditLogger) { + MDC.remove(LoggerProperties.MDC_CLASS_NAME); + MDC.remove(LoggerProperties.CUSTOM_FIELD1); + MDC.remove(LoggerProperties.CUSTOM_FIELD2); + } + MDC.remove(MDC_KEY_REQUEST_ID); } @@ -322,9 +348,8 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { /** * Initializes the logger context. */ - public void init(String appName) { + public void init() { setGlobalLoggingContext(); - MDC.put(MDC_SERVICE_NAME, appName); } public static String getCurrentDateTimeUTC() { @@ -345,9 +370,9 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { AlarmSeverityEnum alarmSeverityEnum = epMessageEnum.getAlarmSeverity(); ErrorSeverityEnum errorSeverityEnum = epMessageEnum.getErrorSeverity(); - MDC.put(MDC_ALERT_SEVERITY, alarmSeverityEnum.name()); - MDC.put("ErrorCode", epMessageEnum.getErrorCode()); - MDC.put("ErrorDescription", epMessageEnum.getErrorDescription()); + MDC.put(MDC_ALERT_SEVERITY, alarmSeverityEnum.severity()); + MDC.put(LoggerProperties.ERROR_CODE, epMessageEnum.getErrorCode()); + MDC.put(LoggerProperties.ERROR_DESCRIPTION, epMessageEnum.getErrorDescription()); String resolution = this.formatMessage(epMessageEnum.getDetails() + " " + epMessageEnum.getResolution(), (Object[]) param); @@ -361,8 +386,8 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { } catch (Exception e) { errorLogger.error("logEcompError failed", e); } finally { - MDC.remove("ErrorCode"); - MDC.remove("ErrorDescription"); + MDC.remove(LoggerProperties.ERROR_CODE); + MDC.remove(LoggerProperties.ERROR_DESCRIPTION); MDC.remove(MDC_ALERT_SEVERITY); } } @@ -395,7 +420,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { try { MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName()); MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress()); - MDC.put(MDC_INSTANCE_UUID, LoggerProperties.getProperty(LoggerProperties.INSTANCE_UUID)); + MDC.put(MDC_SERVICE_NAME, LoggerProperties.getPropertyValue(LoggerProperties.APP_NAME)); } catch (Exception e) { errorLogger.error("setGlobalLoggingContext failed", e); } @@ -484,4 +509,22 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { } return ""; } + + /** + * + * @param beginDateTime + * @param endDateTime + */ + private void calculateDateTimeDifference(String beginDateTime, String endDateTime) { + if (beginDateTime != null && endDateTime != null) { + try { + Date beginDate = ecompLogDateFormat.parse(beginDateTime); + Date endDate = ecompLogDateFormat.parse(endDateTime); + String timeDifference = String.format("%d", endDate.getTime() - beginDate.getTime()); + MDC.put(LoggerProperties.MDC_TIMER, timeDifference); + } catch (Exception e) { + errorLogger.error("calculateDateTimeDifference failed", e); + } + } + } } diff --git a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/LoggerProperties.java b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/LoggerProperties.java index abd98b19..4287088b 100644 --- a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/LoggerProperties.java +++ b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/LoggerProperties.java @@ -37,13 +37,24 @@ */ package org.onap.portalsdk.core.logging.logic; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Properties; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.springframework.util.ResourceUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + public class LoggerProperties { - public static final String MDC_APPNAME = "AppName"; public static final String MDC_REST_PATH = "RestPath"; public static final String MDC_REST_METHOD = "RestMethod"; @@ -62,20 +73,34 @@ public class LoggerProperties { public static final String CLIENT_IP_ADDRESS = "ClientIPAddress"; public static final String STATUS_CODE = "StatusCode"; public static final String RESPONSE_CODE = "ResponseCode"; - + public static final String HTTP = "HTTP"; public static final String HTTPS = "HTTPS"; public static final String UNKNOWN = "Unknown"; public static final String PROTOCOL = "PROTOCOL"; public static final String USERAGENT_NAME = "user-agent"; public static final String USER_ATTRIBUTE_NAME = "user_attribute_name"; - - private LoggerProperties(){} + public static final String ALERT_SEVERITY = "AlertSeverity"; + public static final String ERROR_CATAGORY = "ErrorCatagory"; + public static final String ERROR_CODE = "ErrorCode"; + public static final String ERROR_DESCRIPTION = "ErrorDescription"; + public static final String CUSTOM_FIELD1 = "CustomField1"; + public static final String CUSTOM_FIELD2 = "CustomField2"; + public static final String APP_NAME = "application_name"; + + private LoggerProperties() { + } + + private static Properties properties; + + private static DocumentBuilderFactory dbFactory; + + private static DocumentBuilder dBuilder; + + private static Document doc; - private static Properties properties; - - private static String propertyFileName = "logger.properties"; + private static String propertyFileName = "classpath:logback.xml"; private static final Object lockObject = new Object(); @@ -83,8 +108,7 @@ public class LoggerProperties { * Gets the property value for the specified key. If a value is found, leading * and trailing space is trimmed. * - * @param property - * Property key + * @param property Property key * @return Value for the named property; null if the property file was not * loaded or the key was not found. */ @@ -113,21 +137,68 @@ public class LoggerProperties { * whether the properties file can be loaded successfully. * * @return True if properties were successfully loaded, else false. - * @throws IOException - * On failure + * @throws IOException On failure + * @throws SAXException + * @throws ParserConfigurationException */ private static boolean initialize() throws IOException { - if (properties != null) + File xmlFile = null; +// if (properties != null) +// return true; +// InputStream in = LoggerProperties.class.getClassLoader().getResourceAsStream(propertyFileName); + + if (dbFactory != null) return true; - InputStream in = LoggerProperties.class.getClassLoader().getResourceAsStream(propertyFileName); - if (in == null) - return false; - properties = new Properties(); +// if (in == null) +// return false; + if (dbFactory == null) +// properties = new Properties(); + dbFactory = DocumentBuilderFactory.newInstance(); try { - properties.load(in); +// properties.load(in); + xmlFile = ResourceUtils.getFile(propertyFileName); + dBuilder = dbFactory.newDocumentBuilder(); + doc = dBuilder.parse(xmlFile); + doc.getDocumentElement().normalize(); + } catch (IOException | SAXException | ParserConfigurationException e) { + return false; } finally { - in.close(); +// in.close(); } return true; } + + public static String getPropertyValue(String propertyName) { + + if (dbFactory == null) { + synchronized (lockObject) { + try { + if (!initialize()) { + return null; + } + } catch (IOException e) { + return null; + } + } + } + String value = getValue(doc, propertyName); + if (value != null) + value = value.trim(); + return value; + + } + + private static String getValue(Document someNode, String property) { + NodeList nodeList = someNode.getElementsByTagName("property"); + String Value = null; + for (int i = 0; i < nodeList.getLength(); i++) { + Node node = nodeList.item(i); + if (node instanceof Element) { + if (((Element) node).getAttribute("name").toString().equals(property)) { + Value = ((Element) node).getAttribute("value").toString(); + } + } + } + return Value; + } } \ No newline at end of file -- cgit 1.2.3-korg