Specialized Administration > Site Maintenance > Windchill MBeans > MethodContexts (Monitors)
  
MethodContexts (Monitors)
The MethodContexts MBean monitors method server method contexts and thus is only instantiated in method servers.
Use this MBean to establish what data is logged in the method server.
By default, the following values are set for ContextLoggerOutputAttributes:
StartTime, Id, ParentId, IeContextIds, ServletRequestId, UserName,
RemoteAddr, TargetClass, TargetMethod, AccessLogDetail, Redirects,
JDBCQueryCalls, ElapsedJDBCSeconds, ElapsedTotalCpuSeconds, ElapsedTotalSeconds
* 
If you choose to modify the output attributes, be aware that to get the data needed for tracing anything through Windchill, you must include IeContextIds and ServletRequestId in ContextLoggerOutputAttributes.
If the ContextLoggerLevel is set to INFO, then the following is a sample of the output in the method server log (formatted to fit the page):
2010-12-30 14:55:10,246 INFO [RMI TCP Connection(23)-132.253.12.51]
wt.method.MethodContextMonitor.contexts.rmi wcadmin - 2010-12-30 20:55:09.715
+0000, 10wdulv;gic4vdn7;5780;cplas;9, -, -, -, wcadmin, 132.253.12.51,
wt.query.template.ReportTemplateHelper$Server, hasModifyAccess, ,
0, 1, 0.233122646, 0.03125, 0.530067928
In this sample, data field names are not shown because the default short format omits the names to avoid repeatedly outputting them in the log entries. (You can change the default using either the MethodContextMonitor MBean or the Performance Feedback Settings).
The items included in this sample (after the common information about logger time, log event level, thread, logger name, and current user) are:
StartTime - start time of method context: 2010-12-30 20:55:09.715 +0000
Id - method context ID: 10wdulv;gic4vdn7;5780;cplas;9
Notice that the delimiter is a comma. The semicolon is considered part of the contextId string.
ParentId - ID of parent method context: none (-)
IeContextIds - associatedInfo*Engine context ids: none (-)
ServletRequestId - associated servlet request id: none (-)
UserName - name of user for which the method context is invoked: wcadmin
RemoteAddr - remote IP address of the method context call: 132.253.12.51
TargetClass - target class: wt.query.template.ReportTemplateHelper$Server
TargetMethod - target method: hasModifyAccess
AccessLogDetail - additional details: none
Redirects - number of times call was redirected: 0
JDBCQueryCalls - JDBC query call count: 1
ElapsedJDBCSeconds - time spent in JDBC calls: 0.233122646 seconds
ElapsedTotalCpuSeconds - CPU time used for method context: 0.03125 seconds
ElapsedTotalSeconds - elapsed time of method context: 0.530067928 seconds
* 
From the Operations node, you can use the captureActiveContexts button to capture running contexts. They will then display under MethodContexts MBean.
The statistical summary provided in the method server log through wt.method.MethodContextMonitor.stats.summary can be helpful when reviewing system performance. For example, the following sample output from the method server log (formatted to fit the page) shows information about the active method contexts using the method server during the specified time interval (identified by ElapsedSeconds):
2010-12-10 17:48:50,290 INFO [wt.jmx.core.SharedScheduledExecutor.worker]
wt.method.MethodContextMonitor.stats.summary Administrator -
ElapsedSeconds=600.008322566, CompletedContexts=630, ErrorCount=0,
RedirectCount=0, ContextSecondsAverage=0.3671603731396825,
ContextSecondsMax=42.013152789, ContextCpuSecondsAverage=0.03640873015873016,
ContextUserSecondsAverage=0.03318452380952381,
ContextJDBCConnWaitSecondsAverage=1.294644634920635E-4,
ActiveContextsAverage=0.38546599761132355,
ActiveContextsMax=10, ActiveContextsStart=0, ActiveContextsEnd=0,
AverageJDBCCallsPerContext=3.212698412698413,
AverageJNDICallsPerContext=0.009523809523809525,
PercentageOfContextTimeInJDBCCalls=10.215606919069739,
PercentageOfContextTimeInJDBCConnWait=0.03526101207082334,
PercentageOfContextTimeInJNDICalls=0.008320770340035786
Many items in this log entry are self explanatory. The following list provides some additional information:
CompletedContexts indicates the number of method contexts that completed execution during the specified time interval.
ContextCpuSecondsAverage indicates the average number of CPU seconds used by the contexts.
ActiveContextsAverage provides the average number of active contexts for the time interval.
ContextSecondsMax indicates the maximum number of seconds used by any context executing during the time interval.
ActiveContextsMax indicates the maximum number of contexts executing at one time during the time interval.
ActiveContextsStart identifies the number of contexts executing at the beginning of the time interval.
ActiveContextsEnd identifies the number of contexts executing at the end of the time interval.