Friday 21 November 2014

Enable logging for particular UBEs

This is potentially one of the best posts that I’ve done in a while… Well, perhaps it might be one of the most helpful ones in a while.  But, I’d best get off my soap box and get into the nitty gritty of the post.

It’s a common situation that a UBE goes into Error sometimes and works the rest of the time…  So, you need debug…  Your choices are limited for enabling logging, as it’s pretty global on your enterprise server and will be enabled for all UBE’s and all processes that start after you’ve enabled the setting in the JDE.INI file.

I had this conundrum at a client recently and decided to try and enable logging in an OSA.  If I could enable logging with an OSA, I could map this to any UBE that I needed to enable logging for.  Therefore, no package builds, no deploys, no global logging enabled – just logging for the UBE’s that I want to log WHEN I want to log them. 

So now you can configure what logging is enabled for a UBE based on :

  • version
  • environment
  • machine

Too good to be true, no – it actually worked!  The best thing is, I’m going to give you all of the source code as well.  All 1 line of it!

EXTERNC APIEXPORT void CDECL myriadEnableLogging(POSA_REPORT_INFO pOSAReportInfo,
POSA_LINK_INFO pOSALinkInfo,
unsigned long ulNumberOfLinks)
{
//jdeDebugInit();
changeLogSettingsNoINI(_J("Output"), 1);
}


 


So you can map this to the UBE that you want logging via the OSA application.


You need to compile the code above into a DLL (in my case called myOSA) and plonk this in the enterprise server bin32 dir. 


Then create the OSA definition P986168 for enableLogging


image


The first button above and then add


image


Then map your UBE’s that you want logging on for (the second button)


image


The second button


image


So in this example I’m enabling logging for all users that run R42565 in JDV910.


If you want a windows DLL prebuilt with this code, let me know and I’ll probably be nice and send it to you.

10 comments:

Unknown said...

This looks very interesting. Would you share the compiled .dll that you suggested?

Thank you.

Shannon Moir said...

hey john. send me an email at shannon dot moir @myriad-it.com . i could not work out how to het an email address from your profile.

Unknown said...

Wow really nice post

And i want your dll too :)

I log my Gmail account so you should be able to get it

Thx a lot

Shannon Moir said...

Hey there, I've shared a google folder, so you should just be able to grab the DLL from here. I've added a few other files too to ensure that thing's will work with the runtime libraries on your enterprise server.

https://drive.google.com/?tab=mo&authuser=0#folders/0B30UFGvbR-EjTU45X3NJRzViWHM

Bang the 4 files here into the bin32 dir and follow the instructions for the OSA mapping.

The case and name of the function in the OSA definition is vital:

myriadEnableLogging

Good luck!

Please note that this DLL contains email code, print code and other code. If you want to email the results of a PDF or print them immediately, you can call different functions in this DLL.

Anonymous said...

Hi Shannon,

I recently found this post and wanted to implement it. We are on TR 9.1.4.2. I followed the instructions as given above. Unfortunately, when I run a UBE on the Server, it does not generate any logs. Question: Does the server need to be bounced in order for this to take effect?

Cheers!!

Shannon Moir said...

Hi There,
There are a few things that you need to look for. You need to ensure that you copy in the DLL & the other files to the bin32 dir. You also need to ensure that when you run the ube manually (for example) that the OSA box is getting ticked by the system (this is a good way of checking your setup). Also look in the error logs for problems with loading the DLL that you've put into the bin32 dir. Also (jeepers - lots of also's) look at your event viewer for SxS errors - hinting towards incompatibility with runtime libraries.

Unknown said...
This comment has been removed by the author.
Unknown said...

Hi Shannon,

Thanks for this wonderful solution.
Just a reminder that if you want to keep the log files generated through this solution when a batch job finishes successfully (instead of in error), you must have this JDE.INI setting set to a value of 1, otherwise the log file gets deleted once the job is completed.

UBESaveLogFile=1

We learned this by having the log files being deleted in our Production server, but they were not being deleted in the Development server.
After a quick research, I found out about this jde.ini setting. And indeed, our JDE.INI in the Production server had this entry with a value of "0", which will cause the system to not save the UBE log files.

Unknown said...

Hey Shannon,

Did you try your solution with an UBE that has a BI Template report definition associated to it? It does not seem to work in that scenario :-(

I got it to work with UBEs that don't have a Report Definition, but for those that do have a RD, it does not work.

Best,
Silvano

JDEAsm said...

Hi Shannon,

In my case, there are several UBEs called in a scheduler, and I want to generate logs for the erroring UBEs ONLY. I cannot rely on JDE.ini to set the logs and therefore looking for an option where I don't have to depend on JDE.ini to restart. Therefore, your alternative solution looks promising. Is this tools level coding, How do I add code to dll? Could you please elaborate more on this?