New Ranks & Badges For The Community!
Notice something different? The ranks and associated badges have gone "Star Fleet". See what they all mean HERE
Highlighted
Fleet Admiral Fleet Admiral
Fleet Admiral
170 views

logging in EPI Scripting

Hello Support, I am using following to log messages in EPI scripts. 

 

import org.apache.commons.logging.Log 
import org.apache.commons.logging.LogFactory 
private static Log s_log = LogFactory.getLog ("MyClass.class.getName()"); 

def init() 
{
 s_log.error("DEBUG:Script init") 
}

 

 

 

if i use s_log.error, i see the message in the opr-scripting-host.log but if i use s_log.info, i dont see any message there.

 

is it possible to redirect these messages in some other file? if yes what additional lines needs to be added?

 

also, is it possible to enable/disable this logging on somwhere at top level? means i always want to add such logging in my script but when it is moved to prod set the loggin off. if troubleshooting is required switch it back to on.

 

Any help would be appriciated.

Thank You.

-KAKA-

Labels (1)
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

Hello,

 

I am Alejandra an OMi representative and I will help you on this,

Let'me search a little bit about this and I will get back to you.

 

Thanks and Best Regards

HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
0 Likes
Highlighted
Fleet Admiral Fleet Admiral
Fleet Admiral

Hello Kaka,

 

  • I would write
    private static Log s_log = LogFactory.getLog ("MyName in here");
    or
    private static Log s_log2 = LogFactory.getLog(this.class.getName());
  • Logging is per default enabled only for error and fatal
    It can be configured (depending on the component):
    C:\HPBSM\conf\core\Tools\log4j\opr-scripting-host
    -> opr-scripting-host.properties
    At the beginning change
    loglevel=INFO
    to loglevel=DEBUG
  • You can also redirect output to a file. Just use a file redirect as you would do it in e.g. java
    logfile = new File(directory, filename)
    logfile?.append("my message")

 

Kind regards,

Harald

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.