How to enable trace and debug Sterling OMS
What is the use of tracing in OMS?
When really not getting the required result or need to find what exactly happening in newly created service or API we should enable trace and debug. Tracing provides detailed message what the calls been made in process/transaction. Specially able to find the call been made and input and output XML details.
How logging achieved in OMS?
Log4j implementation been used to achieve the log. Anytime we should be able to enable the log or disable the logging using system console. We should use required logging levels (Info, debug, error) while writing Java code.
How to enable trace and debug Sterling OMS
- Login into Application and Launch System Management from System Menu
- From Tools menu click on Trace Components
- Click on Add button
- 3 drop down gets displayed on the “System Management” popup screen
- Component Type
- Component Name
- Trace Level
| Field Name | Description |
| Component Type | API – Trace a standard API given by system
User Exit – Trace an implemented user exit. Service – Trace a service created using the service framework definition Agent – Trace an agent server Application Console – Trace the user interface layer of the Application Console Web UI framework Console – Trace the web user interface framework Console. Health Monitor – Trace a health monitor. Transaction Tracing – Trace a transaction User Tracing – Trace a specific user |
| Component Name | Based on the component type selected, the available components gets displayed the Component Name field. |
| Trace Level | VERBOSE – Displays all the logs available; Highest level of logging
DEBUG – Displays only debug logs SQLDEBUG – Displays all the SQL query been executed for the selected component TIMER – Displays each method entry and exit time details |
Sample Java code with logging
package com.oms94.test;
import java.io.StringWriter;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import com.yantra.yfc.log.YFCLogCategory;
import com.yantra.yfs.japi.YFSEnvironment;
import com.yantra.yfs.japi.YFSException;
public class LoggerTest {
private static YFCLogCategory categoryLogger = YFCLogCategory
.instance(LoggerTest.class.getName() + "-VerboseLogger"); //Category log displayed based on enable trace
private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(LoggerTest.class
.getName()); // Displayed based on log4j file
public Document logger(YFSEnvironment env,Document inputDoc) {
categoryLogger.beginTimer("logger"); // Displayed when TIMER trace level
if (inputDoc == null) {
throw new YFSException("", "logger:Invalid input document received",
"Empty document received");
}
if (categoryLogger.isDebugEnabled()) {
categoryLogger.debug("logger:Input XML :"
+ getXMLString(inputDoc));
}
if (logger.isDebugEnabled()) {
logger.debug("logger:Input XML :"
+ getXMLString(inputDoc));
}
categoryLogger.endTimer("logger");
return inputDoc;
}
private String getXMLString(Document doc)
{
try
{
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.transform(domSource, result);
return writer.toString();
}
catch(TransformerException ex) {
return null;
}
}
}
Interview Question 1: While tracing transaction is there way to trace only particular API or service invoked part of transaction?
Answer: Yes, Specify the trace level in the “TransactionTracingLevel” XML attribute provided in the root element of the API or the service input.
If an invalid or blank value is provided for “TransactionTracingLevel”, the system ignores it.
Interview Question 2: Is there any other way (Not using system management) enable/disable trace?
Answer: modifyTraces API helps enabling the tracing level for the traceable component. View API documentation for more details
Interview Question 3: How to override log4j properties file
Answer: In customer_overrides.properties add below line
yfs.log4j.configuration=/resources/log4jconfig.modified.xml
Reference:




if you want even more loging then start your server with these jvm arguments:-
-Dyfs.logall=Y
this is useful for sever startup debugging.
Thanks for the useful information. Even though I learned this long back but did not recollect when we wrote the post. Very useful one !!!
Keep sharing your feedback on all post anonymously. Thanks once again
That’s nothing… Your help is always greatly/grately appreciated…
Thanks lot for wonderful comment
This one (logAll) we got to use recently when we were clueless even after tracing…
Pingback: Sterling OMS How Template Customization improves performance - Learn IBM Sterling Order Management System
Do you know a JVM arg that would work to always turn on tracing? In COM, you would send CTRL-F2 to enable tracing. Anyway to auto get that to turn on in com.ini?