MicroStrategy ONE
Formatter
A formatter object converts a log record (internal data structure for a log message) into a string of desired format such as XML. In addition to the message, a log record contains information about the logging level, type of message, and the exception thrown, if any.
The following formatters are used by MicroStrategy Web products.
XMLFormatterEx
This formatter in the com.microstrategy.web.app package outputs the log messages as a simple string message in an XML format. A sample record is as follows:
<record>
<package>com.microstrategy.webapi</package>
<level>SEVERE</level>
<miliseconds>1116947168374</miliseconds>
<timestamp>05/24/2005 11:06:08:374</timestamp>
<thread>0</thread>
<class>CDSSXMLReportServer</class>
<method>GetExecutionResultsEx</method>
<message>User request is completed
Failed to contruct the message result.
(The object with the given identifier is not an object of the expected type.) (com.microstrategy.webapi.MSTRWebAPIException)</message>
<exception>com.microstrategy.webapi.MSTRWebAPIException: User request is completed
Failed to contruct the message result.
(The object with the given identifier is not an object of the expected type.)
	…</exception>
<userName>John Doe</userName>
<clientID>10.15.100.1</clientID>
</record>
SimpleFormatter
This formatter in the com.microstrategy.utils.log package outputs the log messages as a simple string message in the following format.
[packageName Level] [TimeStamp] [Thread ID] [ClassName.MethodName] Log Message
The Log Message generated is shown below.
-
[com.microstrategy.objects SEVERE] [4/17/2002 18:34:31:766] [0] [CDSSXML.MethodName] 0x80044030: No owner object found.
-
com.microstrategy.objects SEVERE] [4/17/2002 18:34:32:177] [0] [CDSSXML.MethodName] : This is a runtime exception
The Log Message includes the following information:
-
Error Code— Error message in case of a Web Objects Exception or MSTRAPIException.
-
:— The semi-colon acts as a delimiter.
-
Error Message— Message in case of log messages lower than logging level SEVERE (for example WARNING, INFO, CONFIG, and so on)
ExtendedFormatter
This formatter in the com.microstrategy.utils.log package outputs the log messages as a simple string message similar to SimpleFormatter. In addition, it also records the arguments or parameters if any are passed to the log message (for example, log messages created during function entry and return). In case of an exception, this formatter prints out the stack trace as well.
The log messages are displayed in the following format.
[packageName Level] [TimeStamp] [Thread ID] [ClassName.MethodName] Log Message [stack trace if exception] [parameterlist if any]
The parameterlist includes the list of parameters and their values in the following format.
[param0=parameter0Value,param1=parameter1Value……,paramn=parameternValue]
The Log Message generated is shown below.
1) [com.microstrategy.objects SEVERE] [4/17/2002 18:45:45:305] [0] [CDSSXML.Something] 0x80044030: No owner object found [com.microstrategy.webapi.MSTRWebAPIException: No owner object found in XML.
at com.microstrategy.webapi.ThrowException.throwException(ThrowException.java:21)
at com.microstrategy.utils.log.TestSimpleFormatter.test1(TestSimpleFormatter.java:28)
at com.microstrategy.utils.log.TestSimpleFormatter.main(TestSimpleFormatter.java:18)
]
2) [com.microstrategy.objects SEVERE] [4/17/2002 18:45:45:735] [0] [CDSSXML.Something] : This is a runtime exception[java.lang.RuntimeException: This is a runtime exception
at com.microstrategy.utils.log.TestSimpleFormatter.test2(TestSimpleFormatter.java:47)
at com.microstrategy.utils.log.TestSimpleFormatter.main(TestSimpleFormatter.java:18)
][param0=Hello,param1=1]
3) [com.microstrategy.objects WARNING] [4/17/2002 18:45:45:755] [0] [CDSSXML.Something] Warning message .....
4) [com.microstrategy.objects FINE] [4/17/2002 18:45:45:755] [0] [CDSSXML.Something] Fine trace message .....
5) [com.microstrategy.objects FINE] [4/17/2002 18:45:45:755] [0] [TestClass.Something] Fine trace message ..... [param0=Hello,param1=1]
The log message in example 1 above does not have any parameter list. In example 2, the log message has an exception as well as a parameter list. In example 3, the log message is a WARNING message with no parameters passed. The log message in example 4 is a FINE message with no parameters passed whereas the log message in example 5 is a FINE message with two parameters that are passed.
See also