cancel
Showing results for 
Search instead for 
Did you mean: 

Logging from custom java jar in script snap

kpatnala
New Contributor

Hi,

I have a Java Jar file which has a method inside a class that returns a string value, and I also have a log4j logger inside the method.
I placed these 2 jars mycustom.jar and log4j.jar in node path.
In script snap (python) I mentioned the path of the jar and importing the class and able to call the method and get the output string successfully.
The problem is mycustom.jar is not able to create a log file in the path that I mentioned in the log4j.properties file and append logs to it.
Does anybody have idea on this or suggest the cause of the issue?

How to import custom class?

Importing Third Party Libraries

https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1439321/Script
Thanks,
Kiran

1 REPLY 1

Supratim
Contributor III

@kpatnala You can try below step in python scripts-

  1. At Import/Declartion
    sys.path.append(‘/opt/snaplogic/run/lib/custom.jar’)
    from com.test.mypack import MyClassName

  2. Inside try -
    myClass=new MyClassName()
    myClass.myFuc()