Custom log file with ODM API
Tuesday, 04 July 2017 by Angello Manrique Vigil
Given the positive feedback from previous post we will continue to work further on with the ODM API and discover new possibilities and features to implement in our Rule projects. In this tutorial we will see how to create a custom log file, focusing on obtaining the values from Deployments of Decision Services within the Business Console.
To understand the basics of the IBM ODM, please refer to my previous post about the IBM ODM API here.
- Creating a custom log file
- In our Java ODM API project let’s create a global variable to define the output file.
- Now create a constructor method to add the values you want in your custom log file. In this example we are obtaining the deployment time stamp when a business user deploys a Decision Service from the Business Console:
- Tip: Remember we need to throw an IOException class for our constructor.
- We can continue adding the values we require in our outfile variable. In this code example we are getting the following values:
- Tip: Remember to format the log file with methods like newLine() and flush().
- Now we need to repackage and reinstall the teamserver.ear with our custom jar file and it will automatically start generating the log file when we make a Decision Service deployment. I will make a post explaining this process in detail in the future.
If we did not specify an output location for the log file you will find it in <Your WAS Installation Path>\logs. I hope you enjoy this tutorial it helps you, please feel free to contact me with any feedback or questions! Thank you!
- Published in Decision Center, Java, ODM API, Rule Authoring, Rule Designer