Searching the Help
To search for information in the Help, type a word or phrase in the Search box. When you enter a group of words, OR is inferred. You can use Boolean operators to refine your search.
Results returned are case insensitive. However, results ranking takes case into account and assigns higher scores to case matches. Therefore, a search for "cats" followed by a search for "Cats" would return the same number of Help topics, but the order in which the topics are listed would be different.
Search for | Example | Results |
---|---|---|
A single word | cat
|
Topics that contain the word "cat". You will also find its grammatical variations, such as "cats". |
A phrase. You can specify that the search results contain a specific phrase. |
"cat food" (quotation marks) |
Topics that contain the literal phrase "cat food" and all its grammatical variations. Without the quotation marks, the query is equivalent to specifying an OR operator, which finds topics with one of the individual words instead of the phrase. |
Search for | Operator | Example |
---|---|---|
Two or more words in the same topic |
|
|
Either word in a topic |
|
|
Topics that do not contain a specific word or phrase |
|
|
Topics that contain one string and do not contain another | ^ (caret) |
cat ^ mouse
|
A combination of search types | ( ) parentheses |
|
The log4js script
The log4js is a logger type script similar to log4j. It provides a lightweight but useful script to log events in a HPE Service Manager script that you want to debug . It provides a means to trace information in the Message view while controlling the level of detail being logged. It allows developers to turn in-line debugging on and off.
The log4js script allows developers to set the following logging levels.
log4js log level | Description |
---|---|
OFF | Nothing is logged. |
ALL | Everything is logged. |
DEBUG | Debug information is logged. |
INFO | Information messages are logged (default). |
WARN | Warning messages are logged. |
ERROR | Error messages are logged. |
FATAL | Fatal error messages are logged. |
API Details
The log4js should be initialized before it is used.
Constructor syntax:
var samplelog = new lib.log4js($loglevel, $prefix);
You can also use the following method to create an instance of the logger:
var myLogger=new lib log4js.Log(lib.log4js.Log.INFO);
Sample code snippets
myLogger.info("an info");
myLogger.warn("a warning");
myLogger.error("an error");
You can change the log level or turn off logging with:
myLogger.setLevel(lib.log4js.Log.WARN);
myLogger.setLevel(lib.log4js.Log.OFF);
You can also change the log level or turn off logging with this format:
myLogger.setLevel("WARN");
myLogger.setLevel("OFF");
The log4js script supports appending a prefix to each message. For example:
var myLogger=new lib.log4js.Log("INFO","my prefix");
Type of Logger:
Logger | Description |
---|---|
alertLogger |
Output information to Service Manager Message view or the server log file (default: <SM server installation directory>\logs\sm.log), depending on whether a background or foreground process calls the log4j functions. background: server log foreground: Message view |
API methods:
The following table lists the API methods for log4js.
Method | Description |
---|---|
$log.debug | Write a debug message. |
$log.info | Write an information message. |
$log.warn | Write a warning message. |
$log.error | Write an error message. |
$log.fatal | Write a fatal message. |
$log.setLevel | Set a log level. |
$log.getLevel | Retrieve the log level. |
$log.setPrefix | Set the prefix information. |
$log.getPrefix | Get the prefix information. |
$log.getLogger | Get logger information. |
$log.setLogger | Set the logger information. |
Script name: log4js
Package name: null
Performance impact
The log4js uses the standard Service Manager print method to write the Service Manager server log file or the Messages view, which is useful for debugging your JavaScript, but keep in mind that when logging is turned on there is a performance impact so log4js should be used carefully.
We welcome your comments!
To open the configured email client on this computer, open an email window.
Otherwise, copy the information below to a web mail client, and send this email to ovdoc-ITSM@hp.com.
Help Topic ID:
Product:
Topic Title:
Feedback: