Reading the iMAS log file.
A line in iMAS log looks like this:"Wed May 27|14:07:08.031|D|http-1024-1|Creating a new session|iMASLite|processRequest|85"
What is the meaning of the last digit in this pattern seen in log file?
Sat May 23|12:41:54.890|D|http-1024-1|
Sat May 23|12:41:54.890|D|http-1024-3|
Sat May 23|12:41:54.890|D|http-1024-4|
Answer: "http-1024-4" identifies a thread running on the level of Tomcat in the very early stages of iMAS start up.
_____________________________________________________________________________
'D' is the logger severity 'Debug'. (A: Always, I: Info, E: Error, W: warning)
'1024' is port on which you have Imas running (port for http requests).
Last digit is thread number. Thread '1' is performing one task and while running, it is printing its log.
This is sometimes a thread running on the server:
Wed May 27|10:38:04.437|D|main|
Wed May 27|14:38:18.703|D|ContainerBackgroundProcessor[StandardEngine[Catalina]]|
A log statement from iMAS running in Tomcat 8:
Wed Dec 06|10:00:53.546|I|localhost-startStop-1|SNMP agent initialized with port number [16002]. Trap version [1]. Managing station [172.16.129.35:162] Heartbeat Trap [4] Heartbeat Period [0] Resync Trap [5] Minimum Resync Interval [15000]|com.uws.snmp.SNMPAgent2|initInstance|843
...
Wed Dec 06|10:03:19.441|D|http-nio-8080-exec-1|Application 'Authenticator' is running with language: en|com.uws.infra.SessionContextFrameWork|getUserLanguage|1562
_____________________________________________________________________________
Wed May 27|14:07:08.031|D|http-1024-1|Creating a new session|iMASLite|processRequest|85
Here,
"Creating a new session" : Message
"iMASLite" : Class path
"processRequest" : Method
"85" : Line number
_____________________________________________________________________________
REFERENCES OF SCREEN IN THE LOG FILE:
Wed Jun 10|16:11:10.325|D|http-9999-1|Invoking com.imas.app.generic.GenericApplication::defaultRequestHandler()|com.imas.app.AppFramework|onRequestIn|456
Wed Jun 10|16:11:10.325|D|http-9999-1|SCREEN NAME = [old_cc] VALUE = [].|com.imas.app.generic.GenericApplication|createUserData|329
...
Wed Jun 10|16:11:13.195|A|http-9999-1|Process = [showeditntsettings] is requested from the client.|com.imas.app.generic.GenericApplication|defaultRequestHandler|532
...screen.put(): Omitting value bcs of NULL...
Wed Jun 10|16:11:11.675|D|http-9999-1|Copying the screen contents to __in variable.|com.imas.app.generic.parser.Screen|execute|129
Wed Jun 10|16:11:11.675|D|http-9999-1|[SCREEN] NAME = [old_cc] VALUE = [].|com.imas.app.generic.parser.Screen|execute|145
...
Wed Jun 10|16:11:11.685|D|http-9999-1|Putting the __in variable in the SCREEN object with [84] entries.|com.imas.app.generic.parser.Screen|execute|156
Fetching GUI application folders from Solaris archive format.
Procedure to fetch GUI application folders from a Solaris package. Please check following procedures. For this you need one Solaris machine.DOWNLOAD THE APPS.PKG.GZ FROM THE RELEASE MGMT SITE:
http://172.16.131.27:9090/release-X86/pkgNEW/
This will be in .gz format. So extract it and you will get .pkg file. Take this .pkg file to your folder in Solaris machine. Then use this command:
pkgtrans RWAR-***FILENAME***.pkg .
Now you will get a folder structure. Inside which you will get app.zip file for specific product. Every product has its different name for app.zip file. For NTR its ntrapps.zip. After extracting this zip file you can see all GUI application folders for this product.
Copy and paste them in $ROAMWARE_HOME/roamwaresds/runtime/webapps folder. Now, restart Tomcat and check.
****************************************************************************************
Use WinSCP to copy-paste folders to-and-fro Solaris. After transferring the files using WinSCP. Use puTTY to run the commands:
ls -lart
#Go to the folder with the .GZ file and run the command given below:
#TO EXTRACT .PKG FILE FROM .GZ ARCHIVE FORMAT:
gzip -d RWARMMServiceAPPS-1.0-Q150604-sol9ORsol10-oci9ORoci10g-i386.pkg.gz
#THEN
pkgtrans RWARMMServiceAPPS-1.0-Q150604-sol9ORsol10-oci9ORoci10g-i386.pkg .
Quick Solaris commands for starting/stopping iMAS/Tomcat server.
1. Output the 'setup environment' file:
cat /dev-1/ashish/RoamwareDeploy/scripts/setup_tomcat8.sh
#!/usr/bin/bash
export ROAMWARE_HOME=/dev-1/ashish/RoamwareDeploy
export CATALINA_HOME=/dev-1/ashish/RoamwareDeploy/admin/jakarta-tomcat-8.0.35
export JAVA_HOME=/opt/jdk1.7.0_21
export PATH=$JAVA_HOME/bin:$PATH
2. Setting up environment:
source /dev-1/ashish/RoamwareDeploy/scripts/setup_tomcat8.sh
3. Stopping Tomcat:
/dev-1/ashish/RoamwareDeploy/admin/jakarta-tomcat-8.0.35/bin/catalina.sh stop
4. Starting Tomcat:
nohup /dev-1/ashish/RoamwareDeploy/admin/jakarta-tomcat-8.0.35/bin/catalina.sh run &
5. Reading Catalina logs:
grep http /dev-1/ashish/RoamwareDeploy/admin/jakarta-tomcat-8.0.35/logs/*
Output:
./jakarta-tomcat-8.0.35/logs/catalina.2017-12-01.log:01-Dec-2017 10:01:18.485 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8385"]
6. Reading iMAS logs:
tail -f /dev-1/ashish/RoamwareDeploy/logs/iMAS/imas.log
cat /dev-1/ashish/RoamwareDeploy/logs/iMAS/imas.log
7. Finding different versions of JDK
which java
/opt/jdk1.7.0_21/bin/java
find /opt -name jdk*8
...
find: cannot read dir /opt/oracle/product/11.2.0/client32/cfgtoollogs/cfgfw/: Permission denied
/opt/jdk1.8.0_92
8. Changing ports (like SNMP, TCP Acceptor) in 'imaslight.properties' file:
vim /dev-1/ashish/RoamwareDeploy/admin/jakarta-tomcat-8.0.35/webapps/ROOT/imaslight.properties
vi /dev-1/ashish/RoamwareDeploy/admin/jakarta-tomcat-8.0.35/webapps/ROOT/imaslight.properties
(Both vim and vi are correct.)
a. For search, enter search mode by typing "/" followed by search string.
To find "16001", type "/16001". Enter.
b. For editing "16001" to "16002", press "i" to enter "INSERT" mode.
Now use direction keys to bring cursor to the position of "1", type "2" and press "Delete" to delete "1" (Note: backspace does not work).
Now press "Esc" to exit "INSERT" mode.
c. For saving the file, press "Esc" to enter command mode, press ":wq" (wq: write and quit).
9. Removing old iMAS logs:
cd /dev-1/ashish/RoamwareDeploy/logs/iMAS
/dev-1/ashish/RoamwareDeploy/logs/iMAS> ksh
/dev-1/ashish/RoamwareDeploy/logs/iMAS> rm -rf imas.2*
/dev-1/ashish/RoamwareDeploy/logs/iMAS> ls -lrth
total 656
-rw-r--r-- 1 ashish roamware 312K Nov 29 15:53 imas.log
Reading "AppAuthorization" data in the HTML, FTL and Rhino.
DATABASE:
select * from appauthorization where appid = 'S30060';
/*
Insert into APPAUTHORIZATION (APPID,AUTHCODE,GRPID,AUTHVALUE,GRANTED) values ('S30060','showgrouptab','1040','yes','Y');
Insert into APPAUTHORIZATION (APPID,AUTHCODE,GRPID,AUTHVALUE,GRANTED) values ('S30060','db.pool.name','1040','default','Y');
Insert into APPAUTHORIZATION (APPID,AUTHCODE,GRPID,AUTHVALUE,GRANTED) values ('S30060','db.pool.name','dragroup','default','y');
Insert into APPAUTHORIZATION (APPID,AUTHCODE,GRPID,AUTHVALUE,GRANTED) values ('S30060','permission','1040','edit','Y');
Insert into APPAUTHORIZATION (APPID,AUTHCODE,GRPID,AUTHVALUE,GRANTED) values ('S30060','permission','dragroup','edit','y');
Insert into APPAUTHORIZATION (APPID,AUTHCODE,GRPID,AUTHVALUE,GRANTED) values ('S30060','sdsservicelist','dragroup','dra','y');
*/
RHINO:
__repository.authz.sdsservicelist
HTML:
<input type = '<#if __repository.authz.showgrouptab?? && __repository.authz.showgrouptab == "yes"> text <#else> hidden </#if>' />
FTL:
<load-data type="sql" name="svclist" main="false" >
<exec-sql type="select" multivalued="true" >
<sql>
<![CDATA[
select ssm_service_name, ssm_service_description from sds_service_master
<#if __repository.authz.sdsservicelist ??>
where ssm_service_name in (
<#list __repository.authz.sdsservicelist?split(',') as val>
'${val?upper_case}'<#if val_has_next>,</#if>
</#list>
)
</#if> order by svcdesc
]]>
</sql>
</exec-sql>
</load-data>
Printing the contents of Freemarker list generated from <load-data> tag of iMAS.
IMAS:<process name="showleftframe">
<load-data type="sql" name="cosfeaturename" main="false">
<exec-sql type="select" multivalued="false">
<sql>
<![CDATA[
SELECT param_value AS cosfeaturename FROM sds_service_config
WHERE lower(svc_name) = 'amms'
AND param_name='amms.cos.feature.name'
AND 'cosengine' = (SELECT param_value FROM sds_service_config WHERE lower(svc_name) = 'amms' AND
param_name='sds.cos.plugin')
]]>
</sql>
</exec-sql>
</load-data>
<!-- Load command code list, which is static data. command codes are mapped to interface -->
<load-data type="dynhandler" name="commandcodelist">
<dynhandler type="data" class="com.roamware.sds2.ui.DiaCommandCodeLoader" />
</load-data>
<load-data type="dynhandler" name="coslist">
<dynhandler type="data" class="com.roamware.sds2.ui.CoSListLoader" />
</load-data>
RHINO:
<script engine="rhino" name="logging" method="loggingfunction" embedded="true">
<![CDATA[
importPackage(java.lang);
importPackage(java.util);
function loggingfunction(input) {
var logger = input.get("__logger");
logger.debug("Coslist: " + input.get("showleftframe_coslist"));
return true;
}
]]>
</script>
LOG:
Fri Nov 27|15:25:19.599|D|http-9999-2|Loaded [6] records for data loader [coslist]. Merging the elements of the last record into the input hash.|com.imas.app.generic.parser.DataLoader|execute|170
Fri Nov 27|15:25:19.629|D|http-9999-2|Coslist: [{name=CoS_0, cosengine, id=0}, {name=CoS_1, cosengine, id=1}, {name=CoS_4, cosengine, id=4}, {name=CoS_5, cosengine, id=5}, {name=CoS_2, cosengine, id=2}, {name=CoS_3, cosengine, id=3}]|sun.reflect.NativeMethodAccessorImpl|invoke0|0
------ ------ ------ ------ ------ ------ ------
More Information:
<script engine="rhino" name="logging" method="loggingfunction" embedded="true">
<![CDATA[
importPackage(java.lang);
importPackage(java.util);
function loggingfunction(input) {
var logger = input.get("__logger");
logger.debug("Coslist: " + input.get("showleftframe_coslist"));
var nwsize = (input.get("showleftframe_coslist")).size(); //java.util.Vector, Vector<Hashtable>
logger.debug("Coslist size: " + nwsize);
return true;
}
]]>
</script>
iMAS Logs:
Fri Nov 27|15:50:01.415|D|http-9999-2|Coslist: [{name=CoS_0, cosengine, id=0}, {name=CoS_1, cosengine, id=1}, {name=CoS_4, cosengine, id=4}, {name=CoS_5, cosengine, id=5}, {name=CoS_2, cosengine, id=2}, {name=CoS_3, cosengine, id=3}]|sun.reflect.NativeMethodAccessorImpl|invoke0|0
Fri Nov 27|15:50:01.495|D|http-9999-2|Coslist size: 6|sun.reflect.NativeMethodAccessorImpl|invoke0|0
------ ------ ------ ------ ------ ------ ------
Another example using with a Freemarker scalars:
Also: "Showing the scope of <load data> list from the <Global> tag"
Also: "Calling iMAS process on click of a link on HTML template"
XML:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE application SYSTEM "../../../application.dtd">
<application name="LNM" type="admin" version="1.0">
<global>
<load-data type="sql" name="cosfeaturename" main="false">
<exec-sql type="select" multivalued="false">
<sql>
<![CDATA[
SELECT param_value AS cosfeaturename FROM sds_service_config
WHERE lower(svc_name) = 'amms'
AND param_name='amms.cos.feature.name'
AND 'cosengine' = (SELECT param_value FROM sds_service_config WHERE lower(svc_name) = 'amms' AND
param_name='sds.cos.plugin')
]]>
</sql>
</exec-sql>
</load-data>
<!-- Load command code list, which is static data. command codes are mapped to interface -->
<load-data type="dynhandler" name="commandcodelist">
<dynhandler type="data" class="com.roamware.sds2.ui.DiaCommandCodeLoader" />
</load-data>
<load-data type="dynhandler" name="coslist">
<dynhandler type="data" class="com.roamware.sds2.ui.CoSListLoader" />
</load-data>
</global>
<app-start>
<invoke-process name="showmainframe" />
</app-start>
<process name="showleftframe">
<script engine="rhino" name="script133" method="createsql" embedded="true">
<![CDATA[
importPackage(java.lang);
importPackage(java.util);
var logger;
function createsql(input) {
logger = input.get("__logger");
logger.debug("From Global section, cosfeaturename: " + input.get("cosfeaturename"));
...
</process>
<screen name="addpage" copyinput="true">
<set-field name="hpmnlist" refvalue="showaddframe.hpmnlist" />
<set-field name="coslist" refvalue="showaddframe.coslist" />
<set-field name="cosfeaturename" refvalue="global.cosfeaturename" />
<set-field name="alliancelist" refvalue="global.alliancelist" />
<set-field name="delmessage" refvalue="${delmessage}" />
<set-field name="isadded" refvalue="${isadded}" />
</screen>
HTML:
<a href="${imas}&c= showleftframe&">CALL IMAS PROCESS</a>
LOG:
Sat Nov 28|12:04:23.945|D|http-9999-5|From Global section, cosfeaturename: AMMS|sun.reflect.GeneratedMethodAccessor39|invoke|0
Using 'screen' program on a *nix machine.
1: For 'screen' program, you need two files '.screenrc' and 'screen'. You can use WinSCP or 'scp' to copy these files on your machine.
1.1: Go to the 'home' directory
bash-3.2$ cd
bash-3.2$ scp amy@192.168.130.55:~/SPRS/setup.sh ./
Password:
scp: ~/SPRS/setup.sh: No such file or directory
bash-3.2$ scp amy@192.168.130.55:.screenrc ./
Password:
.screenrc 100% |***************************************| 19354 00:00
/dev2/home/ashish> scp amy@192.168.130.55:screen ./
Password:
screen 100% |***************************************| 319 KB 00:00
/dev2/home/ashish> scp amy@192.168.130.55:/dev3/amy/screen ./
Password:
screen 100% |***************************************| 319 KB 00:00
2: To create a new screen
screen -S GetICamp
3: To view the existing screen:
./screen -ls
There is a screen on:
2690.GetOM (Detached)
1 Socket in /tmp/uscreens/S-ashish.
4: To enter an existing screen:
./screen -x GetOM
5: Detach from a screen from inside the 'screen', key-combination sequence:
1: Ctrl + A
2: D
6: To create a new tab in a 'screen', key-combination sequence:
1: Ctrl + A
2: C
7: To delete a tab from inside the 'screen':
Ctrl + D
8: To delete a screen:
Press 'Ctrl+D' the number of times equal to the number of tabs in that screen.
Output:
[screen is terminating]
9: To rename a tab in a 'screen', key-combination sequence:
1: Ctrl+A
2: Shift+A
10: While on the 'screen', to switch between tabs, press:
F7
Using the <script> in the <global> tag:
This is an application of the iMAS tag <use-record><use-record>: This tag appears within <exec-sql> tag. Through this tag the result set of SQL execution is made available for manipulation. The manipulation can be done through the <script> tag (as explained below).
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE application SYSTEM "../../../application.dtd">
<application name="Policy Configuration" type="admin" version="1.0">
<global>
<load-data type="sql" name="labels" main="false" >
<exec-sql type="select" multivalued="false" >
<sql>
<![CDATA[ select 'lables' from dual ]]>
</sql>
<use-record>
<script engine="rhino" name="loadAppLabels" method="myMethod" embedded="true">
<![CDATA[
importPackage(java.lang);
importPackage(java.util);
importPackage(java.io);
function myMethod (input)
{
var logger = input.get("__logger");
var screen = input.get("__screen");
...
return true;
}
]]>
</script>
</use-record>
</exec-sql>
</load-data>
...
</global>
<app-start>
<invoke-process name="showfirstpage" />
</app-start>
Quirk 1: What happens when your application is using Freemarker2 but column 'renderer' in table 'applications' says 'freemarker' and not 'freemarker2'
When your application is using Freemarker2 but column 'renderer' in table 'applications' says 'freemarker' and not 'freemarker2', during this mismatch you will observe following difference in the iMAS logs:
Logs with renderer mismatch:
Mon Mar 12|21:27:02.002|D|http-nio-8443-exec-7|Loading freemarker template: /opt/Roamware/roamwaresds/runtime/webapps/S363/templates/en/querypage.html|com.uws.infra.renderer.FreeMarkerRendererFactory|getTemplate|179
Mon Mar 12|21:27:02.050|D|http-nio-8443-exec-7|Using renderer instance: FM Renderer [freemarker.template.Template@d041557]|com.uws.infra.SessionContextFrameWork|doRender|1944
Mon Mar 12|21:27:02.052|D|http-nio-8443-exec-7|Getting converter: com.uws.infra.util.HTMLEntityHandler|com.uws.infra.renderer.FreeMarkerRenderer|render|58
Mon Mar 12|21:27:02.060|D|http-nio-8443-exec-7|Total number of bytes written: 111|com.uws.infra.SessionContextFrameWork|render|1110
Mon Mar 12|21:27:02.061|D|http-nio-8443-exec-7|<<<< ---- Request handling completed|com.uws.infra.SessionContextFrameWork|requestIn|818
Logs with renderer column is set to 'freemarker2' for Freemarker2 application:
Mon Mar 12|16:20:57.278|D|http-nio-8081-exec-1|Loading freemarker template [S363/templates/en/querypage.html] from [D:\Work Space\Roamware_231117_SCSCA\roamwaresds\runtime/webapps] for application [S363]|com.uws.infra.renderer.FreeMarkerRendererFactory2|getTemplate|209
Mon Mar 12|16:20:57.294|D|http-nio-8081-exec-1|Using renderer instance: FM Renderer2 [2145106720]|com.uws.infra.SessionContextFrameWork|doRender|1830
Mon Mar 12|16:20:57.295|D|http-nio-8081-exec-1|Sending MIME type: text/html|com.uws.infra.http.FMRenderer2|setExtraParams|158
Mon Mar 12|16:20:57.297|D|http-nio-8081-exec-1|Total number of bytes written: 15711|com.uws.infra.SessionContextFrameWork|render|1079
Mon Mar 12|16:20:57.298|D|http-nio-8081-exec-1|<<<< ---- Request handling completed|com.uws.infra.SessionContextFrameWork|requestIn|787
Total number of bytes that were written during the mismatch is '111' (though the file 'querypage.html' size is 14KB). Also, iMAS logs that is used the renderer instance 'freemarker.template.Template' (not 'FM Renderer2').
On the browser, you get a blank page, this could be confusing at first as there is no error reported for this mismatch except for blank page on the browser.
Compiling a product (like OM or SCA) using build command 'ant make'
# In "Roamware_Source" directory, we keep the files such as 'getom_tmobile.sh', 'getom.sh'. This is the directory parallel to which directories like "Roamware" (result of checkout process) and "RoamwareBuild" (result of "ant make" build process) will be created./dev2/home/ashish/Roamware_Source> source getom_tmobile.sh
This has commands to make directories, check this one:
mkdir -p $HOME/Roamware
................................................................
In the file "D:\CVSRoot\products\SCA\6.1\getsca.sh" you notice some commands like these:
cvs -d :pserver:build:build@172.16.XXX.XXX:/cvs/platform checkout -r $RFC_TAG rfc/6.0/cpp
cvs -d :pserver:build:build@172.16.XXX.XXX:/cvs/platform checkout -r $RFC_TAG rfc/6.0/mib
cvs -d :pserver:build:build@172.16.XXX.XXX:/cvs/platform checkout -r $RFC_TAG rfc/6.0/scripts
cvs -d :pserver:build:build@172.16.XXX.XXX:/cvs/platform checkout -r $RFC_TAG rfc/6.0/docs/RFC-ReleaseNotes.txt
Here you have to change these to put your username and password like this:
cvs -d :pserver:username:password@172.16.XXX.XXX:/cvs/platform checkout -r $iMAS_TAG iMAS6.0
................................................................
Our "getsca.sh" file is presently in DOS format:
/dev2/home/ashish/RoamwareSource> vi getsca.sh
#!/usr/bin/bash^M
^M
export RFC_TAG=R171001^M
export STACK_TAG=R170803^M
export NADA_TAG=R130501^M
export MAPSRVR_TAG=R170101^M
...
To change the DOS format file to UNIX format (with LF (0x0A, 10 in decimal) as the only line feed character), use:
dos2unix
Unix-like operating system command
Function: Convert FILE in-place from DOS to Unix format. When no file is given, use stdin/stdout
Syntax: dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...]
Example: dos2unix -iso -n in.txt out.txt
>>> dos2unix getsca.sh getsca.sh
................................................................
# "getsca.sh" script will checkout all the SCA files.
/dev2/home/ashish/RoamwareSource> source getsca.sh
# After the 'checkout' is successful, there will be a directory structure rooted at "/dev2/home/ashish/Roamware":
>>> cd /dev2/home/ashish/Roamware/application/SCA/6.1/build
# At "/dev2/home/ashish/Roamware/application/SCA/6.1/build" will be the "build.xml" file from which we would "ANT MAKE" SCA:
>>> ant make
# After "ANT MAKE", you can find the Zip file that has GUI applications as shown below:
>>> cd /dev2/home/ashish/RoamwareBuild/build
>>> find . -name *.zip
For this case the file is like this:
>>> ls -lh /dev2/home/ashish/RoamwareBuild/build/scaapps/temp/sca/ScaApps.zip
-rw-r--r-- 1 ashish other 359K Mar 19 15:58 /dev2/.../sca/ScaApps.zip
# Note that before SCA, you have to build iMAS (this follows the same steps except different dependencies).
# You can see the SCA dependencies from the file "getsca.sh", here is snippet of the code you have to look for:
export RFC_TAG=R171001
export STACK_TAG=R170803
export NADA_TAG=R130501
export MAPSRVR_TAG=R170101
export EXT_TAG=R170801
export SCA_TAG=Q180205
export IRDB_TAG=R100201
export OM_TAG=R130903
export ENVIRON_TAG=R171201
Accessing the result of single-row SQL query fired in <global> section
XML Code:
<global>
<load-data type="sql" name="kpi_count" main="false">
<exec-sql type="select" multivalued="false">
<sql>
<![CDATA[ select count(kpi_id) as kpi_count from ri_grq_kpi_service_mapping ]]>
</sql>
</exec-sql>
</load-data>
</global>
...
<process name="saveconfiguration">
<script engine="rhino" name="logging" method="logging" embedded="true">
<![CDATA[
importPackage(java.lang) ;
function logging(input) {
var logger = input.get("__logger");
logger.debug("Debug: kpi_count: " + input.get("global_kpi_count").get("kpi_count")); //40
}
]]>
</script>
</process>
No comments:
Post a Comment