2013-09-12

Stand Alone Cognos Log Viewer in IBM Cognos BI 10? YES!

If you want to get Cognos Log Viewer (aka IPF Log Viewer) working stand alone follow this guide.
This was done on a Windows 7 machine. From ANY version/install of Cognos grab the following .jar and .bat files from the <congos>\bin\ directory and put them in their own directory.
CogLogging.jar
dom4j-1.6.1.jar
jakarta-oro-2.0.8.jar
jakarta-regexp-1.3.jar
jaxen-1.1.1.jar
log4j-1.3alpha-6.jar
log4j-chainsaw-1.3alpha-6.jar
log4j-optional.jar
log4j-oro.jar
log4j-xml.jar
logviewV2.jar
xml-apis.jar
runlvV2.bat

Done? Alright open runlvV2.bat in a text editor (notepad.exe) and add a JAVA_HOME variable pointing to the JRE install on your local machine right after the @echo off on a new line or after the first set of rem comments.

Examples:
@echo off
set JAVA_HOME=C:\Progra~1\java\jre1.6.0_18


or


rem variable, then if cannot find one, it will try to use the local distribution.
set JAVA_HOME=C:\Progra~1\java\jre1.6.0_18
rem Causes all changes made to environment variables to be local to this script


In the runlvV2.bat file you will also need to change the set CP=... line near the end of the file to remove the reference to ../webapps/p2pd/WEB-INF/lib/. So the line goes from:
rem ----- Set Up The Runtime Classpath ---------------------------------------- set CP=.;logviewV2.jar;log4j-1.3alpha-6.jar;log4j-chainsaw-1.3alpha-6.jar;log4j-optional.jar;log4j-oro.jar;log4j-xml.jar;jakarta-oro-2.0.8.jar;dom4j-1.6.1.jar;../webapps/p2pd/WEB-INF/lib/jaxen-1.1.1.jar;CogLogging.jar;xml-apis.jar;jakarta-regexp-1.3.jar
@echo Using CLASSPATH: %CP%


To:
rem ----- Set Up The Runtime Classpath ---------------------------------------- set CP=.;logviewV2.jar;log4j-1.3alpha-6.jar;log4j-chainsaw-1.3alpha-6.jar;log4j-optional.jar;log4j-oro.jar;log4j-xml.jar;jakarta-oro-2.0.8.jar;dom4j-1.6.1.jar;jaxen-1.1.1.jar;CogLogging.jar;xml-apis.jar;jakarta-regexp-1.3.jar
@echo Using CLASSPATH: %CP%


Save the modified runlvV2.bat and exit the text editor. Double click the runlvV2.bat file to test that everything works.

If everything works, and it should, you will get two windows that will open. A command prompt window and the Cognos Log Viewer window (screen shots below).
If you close the command prompt window you will cause the Cognos Log Viewer to close. So to tidy things up lets create a VBScript wrapper to hide the command prompt window and save ourselves from doing something silly (like accidentally closing the command prompt).

Create a text file in the same directory as the runlvV2.bat file and call it Launch.vbs. Open this file with a text editor (notepad.exe) and copy/pasta the following code into the file, save and close it.
Launch.vbs code:
CreateObject("Wscript.Shell").Run "runlvV2.bat", 0, True
Now when you want to launch Cognos Log Viewer just double click the Launch.vbs file and you'll only get the Cognos Log Viewer window sans command prompt.

2 comments:

  1. Hey, Thanks for this tip. I have been looking for this for a long time. However, it didn't work when I tried your steps. I did not find xml-apis.jar on any server on my distributed installation. Any thoughts?

    ReplyDelete