MicroStrategy - Logging

mstr

Intelligence Server:
http://community.microstrategy.com/t5/Server/TN11140-What-is-the-DSSErrors-log-how-does-it-work-and-where-is/ta-p/171846 - done reading
http://community.microstrategy.com/t5/Server/TN13943-How-to-change-the-log-destination-for-the-DSSErrors-log/ta-p/174444 - done reading
http://community.microstrategy.com/t5/Server/TN20536-How-to-set-up-collection-of-performance-counters-to/ta-p/180697
http://community.microstrategy.com/t5/Architect/TN33198-What-are-the-different-type-of-log-destinations-that-can/ta-p/183993
http://community.microstrategy.com/t5/Server/TN13313-How-to-enable-logging-of-performance-counters-using-the/ta-p/173853
http://community.microstrategy.com/t5/Server/TN18642-How-to-turn-off-diagnostics-logging-for-MicroStrategy/ta-p/178896
http://community.microstrategy.com/t5/Server/TN11320-How-to-apply-Server-Diagnostics-settings-without/ta-p/172014
http://community.microstrategy.com/t5/tkb/articleprintpage/tkb-id/architect/article-id/3586
http://community.microstrategy.com/t5/Server/TN11320-How-to-apply-Server-Diagnostics-settings-without/ta-p/172014
http://community.microstrategy.com/t5/tkb/articleprintpage/tkb-id/server/article-id/3932

MSTR Web:
http://community.microstrategy.com/t5/tkb/articleprintpage/tkb-id/server/article-id/906
https://lw.microstrategy.com/msdz/MSDL/811/docs/Logger.properties.htm
https://lw.microstrategy.com/msdz/MSDL/940/docs/mergedProjects/websdk/topics/logging/Logging_Examples.htm
https://lw.microstrategy.com/msdz/MSDL/10/docs/WebAPI_doclava/reference/com/microstrategy/utils/log/package-summary.html
https://lw.microstrategy.com/MSDZ/MSDZ_World2015/docs/ReferenceFiles/com/microstrategy/utils/log/package-tree.html
https://lw.microstrategy.com/msdz/MSDZ_World2015/docs/ReferenceFiles/com/microstrategy/utils/log/package-summary.html

Is it possible to aggregate log files generated by MicroStrategy Intelligence Servers to a centralized log server?

This is possible. MicroStrategy has the Diagnostics and Performance Logging tool which allows us to configure various logging aspects of the Intelligence Servers. Although MicroStrategy Intelligence Servers does not have ability to send log message to a centralized log server, it can send log message to Windows event log. We can use other tool to forward these event log to the centralized log server.

If we are using Tomcat, it may be possible to configure Tomcat to forward its log messages to the centralize log server as well.

For MicroStrategy Web (Tomcat), where is the configuration file for logging?

webapps\MicroStrategy\WEB-INF\xml\logging.properties

What is the DSSError log file?

It is the main log file that the Intelligence Server uses.

Where can we find the DSSError log file?

C:\Program Files (x86)\Common Files\MicroStrategy\Log

What are the different log destinations?

  1. System Log (go to the Windows Event Log)
  2. Console Log (go to the console if we run MSTR from the command line)
  3. File Log

Which tool can be used to control the name and location of the DSSError log?

MicroStrategy Diagnostics Configuration Tool.

The DSSErrors.log can be configured by using the MicroStrategy Diagnostics Configuration Tool. This utility exposes two configuration choices - the Machine Default configuration and the CastorServer Instance configuration. The CastorServer Instance is the name given to the Intelligence Server and any changes made to the logs for this configuration will affect the Intelligence Server only. For MicroStrategy Intelligence Server Universal 9.x and newer the Machine Default and Castor Server Instance configurations both use the same default DSSErrors log file location, chosen at installation time.

In order to change the default location for these log files, follow the steps below:

  1. Open the MSIReg.reg file which can be found under the <mstr_home> folder.
  2. To change the location of the DSSErrors.log recorded by the CastorServer Instance, locate the key HKEY_LOCAL_MACHINE\SOFTWARE\MicroStrategy\DSS Server. Modify the LogPath string value for the above key to specify the new location for the DSSErrors.log. Right-click on the LogPath key to modify it and specify the new location for the DSSErrors.log.
  3. To change the location of the DSSErrors.log recorded by the Machine Default, locate the key HKEY_LOCAL_MACHINE\SOFTWARE\MicroStrategy\DSS Suite. Modify the LogPath string value for the above key to specify the new location for the DSSErrors.log. Right-click on the LogPath key to modify it and specify the new location for the DSSErrors.log.

How can we launch the MicroStrategy Diagnostics and Performance Logging tool?

Start menu -> MicroStrategy -> Tools -> Diagnostics Configuration

What is the differences between Machine Default and CastorServer instance?

  • Machine Default: The components and counters displayed reflect the machine on which the user is working.
  • CastorServer Instance: The components and counters displayed reflect server-specific features

When CastorServer Instance is selected, an additional checkbox is available that enables a restoration of default logging levels. On the Diagnostics Configuration tab, this check box is named 'Use Machine Default Diagnostics Configuration.' On the Performance Configuration tab, this check box is 'Use MachineDefault Performance Configuration.' This will pull the diagnostic/performance monitor logging levels from the Machine Default settings.

Generally, the CastorServer instance is used for most traces.

How can we use the MicroStrategy Diagnostics and Performance Logging tool?

  1. Launch it: Start menu -> MicroStrategy -> Tools -> Diagnostics Configuration
  2. At the top, select a configuration. TN13897 explains the differences between "Machine Default" and "CastorServer Instance" but that explanation is as clear as mud. So, try make change to one configuration, and if it doesn't do what we want, make change to the other configuration. Generally, the CastorServer instance is used for most traces.
  3. Search for the "Component" name of the trace, for example "Authentication Server".
  4. Depending on the "Dispatcher" that needs to be logged, move to the "File Log" column and click on <None> and select <New>.
  5. A popup window should appear called Log Destination Editor. Keep "Select Log Destination" as <New> and type in a file name.
  6. Modify the file size as desired and keep the "File Type" as "Diagnostics". Click Save and close the popup window.
  7. The newly named log should appear under the "File Log" column. Click "Save" on the main window.
  8. System Log and Console Log do NOT need to be checked. For an explanation of their functions, refer to TN33198
  9. Most traces will need a server restart to take effect. Restart the Intelligence Server.

Newly created logs are located in the Common Files > MicroStrategy > Log folder on Windows and the /log folder on Unix. After the troubleshooting is complete, remember to turn off unnecessary traces by changing the File Log to <None>.

The screen contains 5 columns: Component, Dispatcher, System Log, Console Log, and File Log. I think the check boxes under the Console Log column is for logging to the console if we are running the Intelligence Server from the command line somehow, and the check boxes under the System Log column is for logging to the system logger (such as the Windows Event Log), and we can use the <None> or <New> options under the File Log column to have it log to a file on the system or turn off logging. I am not sure if MSTR handle log rotation if we choose to log it to a file.

Can we use the MicroStrategy Diagnostics and Performance Logging tool to log the SQL statements that are used inside the reports?

I do not know this yet. But I want to log the first name, last name, the LOGINID of the user that runs the report, the report name, along with the SQL statements that were generated and used inside that report. The components that I might want to crank on:

  • Database Classes (there is an dispatcher for SQL)
  • Database Module
  • Engine
  • Catalog Server (there is an dispatcher for SQL but this is probably not what we want)
  • Catalog Server 2 (there is an dispatcher for SQL but this is probably not what we want)
  • Cube Server
  • Document Server
  • Export Engine
  • FileHelpers
  • FileTransmitter
  • MSql

Can we use the MicroStrategy Diagnostics and Performance Logging tool to log a message to multiple places?

Yes. The interface for the MicroStrategy Diagnostics and Performance Logging tool contains 5 columns: Component, Dispatcher, System Log, Console Log, and File Log. The first column is the list the particular components. The dispatcher is like different log levels. The System Log and the Console Log columns contain check boxes. If you check the check box under the System Log column and the check box under the Console Log column, the log message is sent both to the system logger and console. With the File Log column, you can also indicate that the message should also be sent to a file.

MSTR:

Logging to a file:

# Define an alias for a handler object.
handlers=handler1

# Define the handler as DatedFileHandler so the logger object
# passes the log records to a file.
handler1.class =com.microstrategy.utils.log.DatedFileHandler

# Instruct the DatedFileHandler to accept log messages
# of logging level WARNING or higher
handler1.level=WARNING

# Format the log messages using the formatter called XMLFormatterEx.
handler1.formatter=com.microstrategy.web.app.XMLFormatterEx

# Indicate the destination for the resulting messages.
handler1.pattern=c:/websdk/logs/warnings.txt

# Instruct the Root Logger to accept log messages
# of logging level SEVERE or higher.

level= SEVERE

Logging to a System Console:

# Define an alias for a handler object.
handlers=handler1

# Define the handler as ConsoleHandler so the logger object
# passes the log records to a system console.
handler1.class = com.microstrategy.utils.log.ConsoleHandler

# Instruct the ConsoleHandler to accept log messages
# of logging level SEVERE or higher
handler1.level=SEVERE

# Format the log messages using the formatter called ExtendedFormatter.
handler1.formatter= com.microstrategy.utils.log.ExtendedFormatter

# Instruct the Root Logger to accept log messages
# of logging level SEVERE or higher.

level= SEVERE

Logging to a Debugging Monitor:

# Define an alias for a handler object.
handlers=handler1

# Define the handler as DebugMonitorHandler so the logger object
# passes the log records to a system console.
handler1.class =com.microstrategy.utils.log.DebugMonitorHandler

# Instruct the DebugMonitorHandler to accept log messages
# of logging level SEVERE or higher
handler1.level=SEVERE

# Format the log messages using the formatter called XMLFormatterEx.
handler1.formatter= com.microstrategy.web.app.XMLFormatterEx

# Instruct the Root Logger to accept log messages
# of logging level SEVERE or higher.

level= SEVERE

Logging to a Debugging Monitor and a File:

# Instruct the Root Logger to accept log messages
# of logging level SEVERE or higher.
level= SEVERE

# Define an alias for two handler objects. handler1 will send errors
# to the Debugging monitor while handler2 will send warnings to a file.
handlers=handler1, handler 2

# Define the first handler as DebugMonitorHandler so the logger object
# passes the log records to a system console.
handler1.class =com.microstrategy.utils.log.DebugMonitorHandler

# Instruct the DebugMonitorHandler to accept log messages
# of logging level SEVERE or higher
handler1.level=SEVERE

# Format the log messages using the formatter called XMLFormatterEx.
handler1.formatter= com.microstrategy.web.app.XMLFormatterEx

# Configure the second handler by defining the handler
# as DatedFileHandler so the logger object
# passes the log records to a file.
Handler2.class =com.microstrategy.utils.log.DatedFileHandler

# Instruct the DatedFileHandler to accept log messages
# of logging level WARNING or higher
Handler2.level=WARNING

# Format the log messages using the formatter called XMLFormatterEx.
Handler2.formatter=com.microstrategy.web.app.XMLFormatterEx

# Indicate the destination for the resulting messages.
Handler2.pattern=c:/websdk/logs/warnings.txt

The current logging.properties file:

authH.append=true
authH.class=com.microstrategy.utils.log.DatedFileHandler
authH.count=3
authH.filter=com.microstrategy.web.app.utils.log.GlobClassMethodTracingFilter
authH.filter.errorCodesInclude=-2147216959
authH.formatter=com.microstrategy.web.app.utils.log.AuthFormatter
authH.level=SEVERE
authH.limit=1000000
authH.pattern=C\:/Program Files (x86)/Apache Software Foundation/Tomcat 6.0/webapps/MicroStrategy/WEB-INF/log/MSTRAuthLog%systemdate%.log
com.microstrategy.web.app.tasks.LogUsherUserRegistration.fileH.append=true
com.microstrategy.web.app.tasks.LogUsherUserRegistration.fileH.class=com.microstrategy.utils.log.DatedFileHandler
com.microstrategy.web.app.tasks.LogUsherUserRegistration.fileH.formatter=com.microstrategy.utils.log.ExtendedFormatter2
com.microstrategy.web.app.tasks.LogUsherUserRegistration.fileH.level=OFF
com.microstrategy.web.app.tasks.LogUsherUserRegistration.fileH.limit=1000000
com.microstrategy.web.app.tasks.LogUsherUserRegistration.fileH.pattern=C\:/Program Files (x86)/Apache Software Foundation/Tomcat 6.0/webapps/MicroStrategy/WEB-INF/log/MSTRUsherUserRegistration%systemdate%.log
com.microstrategy.web.app.tasks.LogUsherUserRegistration.handlers=fileH
com.microstrategy.web.app.tasks.LogUsherUserRegistration.level=INFO
consoleH.class=com.microstrategy.utils.log.ConsoleHandler
consoleH.formatter=com.microstrategy.web.app.utils.log.ExtendedFormatterEx
consoleH.level=INFO
fileH.append=true
fileH.class=com.microstrategy.utils.log.DatedFileHandler
fileH.count=100
fileH.formatter=com.microstrategy.web.app.XMLFormatterEx
fileH.level=INFO
fileH.limit=10000000
fileH.pattern=C\:/Program Files (x86)/Apache Software Foundation/Tomcat 6.0/webapps/MicroStrategy/WEB-INF/log/MSTRLog%systemdate%.log
handlers=fileH,consoleH
javaConsoleH.class=com.microstrategy.utils.log.JavaConsoleHandler
javaConsoleH.formatter=com.microstrategy.utils.log.ExtendedFormatter
javaConsoleH.host=localhost
javaConsoleH.level=OFF
javaConsoleH.port=36701
level=INFO

How can we implement our own log handler?

package com.companyName;

import com.microstrategy.utils.log.DatedFileHandler;
import com.microstrategy.utils.log.Handler;
import com.microstrategy.utils.log.LogRecord;

public class KhaiTestMSTRLogHandler extends DatedFileHandler {

    @Override
    public void close() {
        // TODO Auto-generated method stub

    }

    @Override
    public void flush() {
        // TODO Auto-generated method stub

    }

    @Override
    public void publish(LogRecord arg0) {
        // TODO Auto-generated method stub
        System.out.println("From KhaiTestMSTRLogHandler: " + arg0.getMessage());
    }

}

How did I go about getting a certain log messages from MSTR Web and sending them to the Windows Event Log?

There may be practical reason for getting certain log messages from MSTR Web and sending them to the Windows Event Log, such as security auditing and actively improving the quality of your service. The steps involved:

  1. Download a copy of log4j-1.2.17.jar and put it into the webapps\MicroStrategy\WEB-INF\lib folder
  2. Create the log4j.properties file inside the webapps\MicroStrategy\WEB-INF\classes
  3. Implement our own MSTR log handler
  4. Update the webapps\MicroStrategy\WEB-INF\xml\logger.properties file

The content of the webapps\MicroStrategy\WEB-INF\classes\log4j.properties:

log4j.rootLogger=DEBUG, WindowsEventLog
log4j.appender.WindowsEventLog=org.apache.log4j.nt.NTEventLogAppender
log4j.appender.WindowsEventLog.layout=org.apache.log4j.PatternLayout
log4j.appender.WindowsEventLog.layout.ConversionPattern=%d %-5p %c{3} %3x - %m [%t]%n
log4j.appender.WindowsEventLog.source=MSTRWeb
log4j.appender.WindowsEventLog.Threshold=WARN

The content of the webapps\MicroStrategy\WEB-INF\xml\logger.properties file:

#Sat Feb 27 16:25:07 PST 2016
authH.append=true
authH.class=com.microstrategy.utils.log.DatedFileHandler
authH.count=3
authH.filter=com.microstrategy.web.app.utils.log.GlobClassMethodTracingFilter
authH.filter.errorCodesInclude=-2147216959
authH.formatter=com.microstrategy.web.app.utils.log.AuthFormatter
authH.level=SEVERE
authH.limit=1000000
authH.pattern=C\:/Tomcat6M951/webapps/MicroStrategy/WEB-INF/log/MSTRAuthLog%systemdate%.log
com.microstrategy.web.app.tasks.LogUsherUserRegistration.fileH.append=true
com.microstrategy.web.app.tasks.LogUsherUserRegistration.fileH.class=com.microstrategy.utils.log.DatedFileHandler
com.microstrategy.web.app.tasks.LogUsherUserRegistration.fileH.formatter=com.microstrategy.utils.log.ExtendedFormatter2
com.microstrategy.web.app.tasks.LogUsherUserRegistration.fileH.level=OFF
com.microstrategy.web.app.tasks.LogUsherUserRegistration.fileH.limit=1000000
com.microstrategy.web.app.tasks.LogUsherUserRegistration.fileH.pattern=C\:/Tomcat6M951/webapps/MicroStrategy/WEB-INF/log/MSTRUsherUserRegistration%systemdate%.log
com.microstrategy.web.app.tasks.LogUsherUserRegistration.handlers=fileH
com.microstrategy.web.app.tasks.LogUsherUserRegistration.level=INFO
consoleH.class=com.microstrategy.utils.log.ConsoleHandler
consoleH.formatter=com.microstrategy.web.app.utils.log.ExtendedFormatterEx
consoleH.level=INFO
fileH.append=true
fileH.class=com.microstrategy.utils.log.DatedFileHandler
fileH.count=100
fileH.formatter=com.microstrategy.web.app.XMLFormatterEx
fileH.level=INFO
fileH.limit=10000000
fileH.pattern=C\:/Tomcat6M951/webapps/MicroStrategy/WEB-INF/log/MSTRLog%systemdate%.log

KhaiTest.append=true
KhaiTest.class=com.microstrategy.utils.log.KhaiTestCreatingMSTRLogHandler
KhaiTest.count=100
KhaiTest.formatter=com.microstrategy.web.app.XMLFormatterEx
KhaiTest.level=INFO
KhaiTest.limit=10000000
KhaiTest.pattern=C\:/Tomcat6M951/webapps/MicroStrategy/WEB-INF/log/MSTRLog%systemdate%.log

handlers=fileH,consoleH,KhaiTest
javaConsoleH.class=com.microstrategy.utils.log.JavaConsoleHandler
javaConsoleH.formatter=com.microstrategy.utils.log.ExtendedFormatter
javaConsoleH.host=localhost
javaConsoleH.level=OFF
javaConsoleH.port=36701
level=INFO

Basically, I copy everything from fileH and change it to KhaiTest, and add KhaiTest to the handlers line. If we accidentally delete the MSTR's logger.properties file from webapps\MicroStrategy\WEB-INF\xml, MSTR Web will recreate it the next time we start it, and the verbose level goes back to the default value of 'SEVERE', and we would have to use the /MicroStrategy/servlet/mstrWebAdmin interface to change it back to 'Messages'

The code for our own MSTR log handler:

package com.microstrategy.utils.log;
import org.apache.log4j.Logger;
import org.apache.log4j.net.SocketAppender; 
import org.apache.log4j.Priority;
import org.apache.log4j.spi.LoggingEvent;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.PatternLayout;

public class KhaiTestCreatingMSTRLogHandler extends Handler {
    private static Logger logger = Logger.getRootLogger();

    @Override
    public void close() {
        // TODO Auto-generated method stub

    }

    @Override
    public void flush() {
        // TODO Auto-generated method stub

    }

    @Override
    public void publish(LogRecord arg0) {
        // TODO Auto-generated method stub
        String message = arg0.getMessage();
        System.out.println("FROM KhaiTestCreatingMSTRLogHandler:" + message);
        com.microstrategy.utils.log.Level mstrLoglevel = arg0.getLevel();
        if (mstrLoglevel == com.microstrategy.utils.log.Level.ALL) {
            logger.trace(arg0.getMessage());
        } else if (mstrLoglevel == com.microstrategy.utils.log.Level.CONFIG) {
            logger.info(message);
        } else if (mstrLoglevel == com.microstrategy.utils.log.Level.FINE) {
            logger.debug(message);
        } else if (mstrLoglevel == com.microstrategy.utils.log.Level.FINER) {
            logger.trace(message);
        } else if (mstrLoglevel == com.microstrategy.utils.log.Level.FINEST) {
            logger.trace(message);
        } else if (mstrLoglevel == com.microstrategy.utils.log.Level.INFO) {
            logger.info(message);
        } else if (mstrLoglevel == com.microstrategy.utils.log.Level.WARNING) {
            logger.warn(message);
        } else if (mstrLoglevel == com.microstrategy.utils.log.Level.SEVERE) {
            logger.error(message);
        }
    }
}

Notice that in the webapps\MicroStrategy\WEB-INF\xml\logger.properties file, I've configured log level as INFO so that I receive all log messages from MSTR Web, but in the webapps\MicroStrategy\WEB-INF\classes\log4j.properties file, I've configured the threshold as WARN so that only messages with the severity of WARNING will be sent to the Windows Event Log.

We need to download the log4j .zip file, extract it, look for the .dll file, copy the appropriate .dll file to the %SystemRoot%\System32 folder. For the 64-bit platform, copy the NTEventLogAppender.amd64.dll file to the %SystemRoot%\System32 folder. For the 32-bit platform, copy the NTEventLogAppender.dll to the %SystemRoot%\System32 folder.

We also need to use regedit:

  1. Launch regedit
  2. HKLM\SYSTEM\CurrentControlSet\services\eventlog\Application
  3. Create a new key representing the name of your application
  4. Inside this new key, create a new String property and name it EventMessageFile and the value of this property should be the location of the dll file. For 64-bit platform, the value of this property should be %SystemRoot%\System32\NTEventLogAppender.amd64.dll and for 32-bit platform, the value of this property should be %SystemRoot%\System32\NTEventLogAppender.dll

In my case, MSTR Web is the only application being hosted on Tomcat, which was not using log4j so there is conflict. Beside, Tomcat allows each application to use whatever logging library that the application developer want to use, so here, we just simply load the log4j library along with its configuration. In our SDK code, we do not necessarily have to use the logger provided by MSTR (we can use log4j instead). By implementing our own MSTR log handler and configure it in webapps\MicroStrategy\WEB-INF\xml\logger.properties as we did above, we are able to get access to MSTR log messages, and we just simply send those messages to the Windows Event Log using log4j.

Notice that KhaiTestCreatingMSTRLogHandler is created inside the com.microstrategy.utils.log. To do this:

  1. In SpringSource, right click on the Web_Mstr project and select Properties
  2. Click on Java Build Path -> Source
  3. Click on Add Folder
  4. Select the src folder under Web_Mstr and click OK
  5. Click on the "Output folder" line and click on the Edit button
  6. Select the Web_Mstr/WEB-INF/classes
  7. Click OK. This close all the dialogs.
  8. Right click on the src folder and select New -> Class
  9. Specify com.microstrategy.utils.log as the name of the package
  10. Specify the name of the class
  11. Specify the name of the super class (in this case, the name of the super class is Handler)

One of the link above has instruction for how to use the Web Customization Editor to configure MSTR to use our own logger.properties file from plugins/MyCustomLogging/WEB-INF/xml and we probably should follow that instruction. Perhaps, that will make deployment a bit easier (if we can also put the log4j jar file into the plugin's specific WEB-INF/classes and WEB-INF\lib folders)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License