Background
The documentation on this topic is slim on the gory details, so I figured I would write a little bit about it.
The documentation on this topic is slim on the gory details, so I figured I would write a little bit about it.
Keeping it simple, you should always start the ibmdisrv or ibmditk processes with the "-s" flag to specify the solution directory to use. If you don't do this, then you're just using whatever happens to be set in your environment, which could lead to quite a bit of confusion. As an example, you could have your CE (the eclipse IDI GUI) running with a DIFFERENT solution directory than your Default ibmdisrv process. This could lead to a case where properties that resolve perfectly in the GUI don't resolve when you go to run an AL. You can avoid this by always using full paths to properties files, but then that makes your solutions much less portable.
I've been creating a bunch of AssemblyLines in IDI/TDI/ISVDI recently, and wanted to share a trick to help you set up logging to a file whose path includes BOTH the name of the project and the name of the AssemblyLine.
1. In the Log Settings for the AL, make sure to add a log. I prefer FileRollerAppender, but you choose whatever you want.
2. Click on File Path and set it to Advanced (JavaScript)
3. Set the value to the following:
4. Click OK and you're ready to go. The logfile for the AL will be:
/opt/IBM/TDI/logs/project_name/AL_name.log
The Quick and Dirty section above is for advanced/experienced users who have been working with the product for a while and have been beating their heads against a wall trying to find this solution (maybe a handful of people out there). This section is for everyone else.
IDI has tons and tons and tons of logging options. So many, in fact, that most customers will just stick with the default, which logs everything to ibmdi.log, which can make life difficult because all ALs are logged in the exact same file, with their messages intertwined. There can absolutely be benefits to that (i if you're using something like Splunk for centralized log storage, for example). To me, it's much easier to have a different log file for each AssemblyLine. And because you can easily end up with hundreds of ALs in your implementation, it makes sense to me to have one directory per Project, just to make it easier to work through the directory structure.
The specific situation I'm in is that my client has had ITIM and TDI running for over a decade, with different people managing the implementation over the years. This means that they have multiple TDI servers (at various versions) running on the same host. If I was to set this up from scratch starting right now, an easier way to accomplish something VERY similar is to add these two lines to solution.properties for the DI server:
SystemLog.defaultCreateLog=true
SystemLog.defaultMaxGenerations=10
This will cause each AL to log messages in files named:
$SOLDIR/system_logs/$project/$ALName/<logfile>.<timestamp>.log (10 max)
Working with dates in TDI can be tricky, since you'll normally be dealing with not only ISIM's internal format, but also various formats from different databases and other sources. The easiest way I've found is to use the java.time.* classes that were introduced in Java 8. Specifically, the LocalDateTime class is great because it has methods like minusHours(), minusDays(), etc. to make it easy to get a time from "X time ago".
Here are some examples I've come up with to use with the different formats I've run into on my latest contract:
IBM has a support article on this topic here:
Unfortunately, the code provided is incorrect and will throw an exception if you try to use it.
// set up variables to set the erlaststatuschangedate attribute// get milliseconds since epoch in local time zone.var mydate = new Date().valueOf();// get milliseconds of offset from Zulu/UTCvar localOffset = new Date().getTimezoneOffset() * 60000;// add/subtract milliseconds based on local timezone to get Zulu time.var myTZ = mydate + localOffset;// create a new Date() object representing "now" in Zulu time.var utcDate = new Date(myTZ);// Format the date into a string in the correct formatvar myTZStr = new java.text.SimpleDateFormat("yyyyMMddHHmm").format(utcDate);// Add "Z" to the end of the string to complete the correct format.var myTZStrZ = myTZStr + "Z";// set the value of erlaststatuschangedatework.setAttribute("erlaststatuschangedate",myTZStrZ);
So here's a strange one that I didn't find anywhere in my numerous searches, so I figured I would post it here. When running a TDI AssemblyLine, I got the following exception / error:
12:14:43,274 ERROR - [My-JDBC-Connector] CTGDIS810E handleException - cannot handle exception , addonly