Question
Pegasystems Inc.
GB
Last activity: 25 Jul 2018 9:20 EDT
Do PRPC 'Activities' know their own Identity ?
Is there any trick (java step or otherwise) for a running Activity to know its own identity ?
Actually: what I'm after is a way to automatically turn on DEBUG logging in an Activity dynamically (and the oLog object follows a standard pattern : which includes the name of the Activity).
Thanks,
John
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
PEG
US
I modify the activity "pyChangeStage" and I created a local variable called "myRuleKey" and added a Java step that did this:
myRuleKey = pz_CurrentRuleKey;
I could then access the value of local.myRuleKey and it contained this:
RULE-OBJ-ACTIVITY WORK- PYCHANGESTAGE #20180621T113145.478 GMT
Does this give you what you wanted?
PEG
US
I'm currently working an SR where we are dynamically turning on/off logging for other classes. Since you know the syntax to reference your own activity, if you used the same technique, you would be able to do want you want. I'll reach out to the SME who provided the logging steps (I don't seem to be able to find where I squirreled them away), although the customer had to tweak what he provided in order to get it to work. Let's see if he can help. We may have to contact the customer for the final form of what is working.
Pegasystems Inc.
IN
We can use the following in a java step to set the logging level
com.pega.pegarules.priv.LogHelper.setLoggerLevel(String, String)
first parameter : Name of the logger
second parameter: Level
For example to set "com.pega.pegarules.abc.Xyz" to DEBUG use:
com.pega.pegarules.priv.LogHelper.setLoggerLevel("com.pega.pegarules.abc.Xyz", "DEBUG")";
Pegasystems Inc.
GB
Thanks for this - but actually I was after a generic way of doing this (i.e - avoid having to know the name of the logger - but still switch on debug for *this* Activity - whatever *this* may mean).
Accepted Solution
PEG
US
I modify the activity "pyChangeStage" and I created a local variable called "myRuleKey" and added a Java step that did this:
myRuleKey = pz_CurrentRuleKey;
I could then access the value of local.myRuleKey and it contained this:
RULE-OBJ-ACTIVITY WORK- PYCHANGESTAGE #20180621T113145.478 GMT
Does this give you what you wanted?
Pegasystems Inc.
GB
Great - thanks Ron - this looks to be just the ticket (I just need to do some minor reformatting to get the Logger name I reckon)
Cheers
John
Pegasystems Inc.
GB
Just a side-note: not sure if this would be useful in real-life for anything; or indeed how wise it would be to rely on these built-in Local Variables to remain available over versions....
But you can even open up the entire 'source' rule form by a "OBJ-OPEN-BY-HANDLE ", using
Local.pz_CurrentRuleKey
As the 'InstanceHandle'. (Use a Page of Class "Rule-Obj-Activity" on the Step Page).