How to detect any error after run generate.bat?

Uploaded report templates and discussions about reports.

Moderators: sarawut_w, Moderators

How to detect any error after run generate.bat?

Postby zzhou@solielcom.com » Mon Jul 01, 2019 1:40 pm

Hi,we are using a java program to execute generate.bat command for each project and wait on the InputStream and ErrorStream.
The problem is, some of the project to be loaded has some error and couldn't be loaded, but it fails quitely, only put the information into cea.log,
the calling process is waiting on the input streat, so, it will wait a long time to time out for some failed project. I saw some error information in cea.log,
is there any way we can force the error goes to the error stream (System.err) besides going to the log file? That way, my calling process will know error happend and not wait for it
anymore.

Thanks!
zzhou@solielcom.com
Forum Newbie
Forum Newbie
 
Posts: 10
Posts Rating:0
Joined: Mon Jul 01, 2019 1:30 pm

Re: How to detect any error after run generate.bat?

Postby sarawut_w » Mon Jul 01, 2019 9:43 pm

Hello,

What is your MagicDraw version?

Best regards,
Sarawut W.
Support Engineer
sarawut_w
No Magic
No Magic
 
Posts: 382
Posts Rating:29
Joined: Thu Jun 23, 2011 12:47 am

Re: How to detect any error after run generate.bat?

Postby zzhou@solielcom.com » Tue Jul 02, 2019 11:53 am

18.5
If check the execStatus, it always returns 0 even if there is some error during the generate and the output file is not created. I can only check if the output file exists to decide if the generate runs success or not.
Also, not sure why the process continues run for a while even though it encounters some error and not write to the output file. Is there any api I can use to check if the project is good or bad for generate scripts to run against in advance?

Thanks!
zzhou@solielcom.com
Forum Newbie
Forum Newbie
 
Posts: 10
Posts Rating:0
Joined: Mon Jul 01, 2019 1:30 pm

Re: How to detect any error after run generate.bat?

Postby sarawut_w » Wed Jul 03, 2019 7:53 pm

Hello,

Because the geneate.bat has many commands for Java, it would check for exit status at the last command.
In case, invalid project when executing generate.bat, there are system.exit at line4, it still continue work at line6.

You need to extract this below zip file to {MD}\plugins\com.nomagic.magicdraw.reportwizard.
community_18386.zip

We created commandline2.jar for ensure that there is System.exit(statusCode) when there is error in the process.
You should execute it with this command.
Code: Select all
generateandexit -strategy "com.nomagic.magicdraw.magicreport.CommandLine2" following with common arguments

For example:
Code: Select all
generateandexit -strategy "com.nomagic.magicdraw.magicreport.CommandLine2" -project "C:\Users\uraiwan_i\Desktop\sample.mdzip" -output "C:\Users\uraiwan_i\Desktop\test.docx" -template "Class Specification Report" -package "Model"


See the sample in TestCommandLine.java

Best regards,
Sarawut
You do not have the required permissions to view the files attached to this post.
sarawut_w
No Magic
No Magic
 
Posts: 382
Posts Rating:29
Joined: Thu Jun 23, 2011 12:47 am

Re: How to detect any error after run generate.bat?

Postby zzhou@solielcom.com » Fri Jul 12, 2019 7:55 am

Thanks! I will give it a try. It should work for both windows and unix, right?

Thanks!
zzhou@solielcom.com
Forum Newbie
Forum Newbie
 
Posts: 10
Posts Rating:0
Joined: Mon Jul 01, 2019 1:30 pm

Re: How to detect any error after run generate.bat?

Postby sarawut_w » Tue Jul 16, 2019 9:37 pm

Yes, it is.
sarawut_w
No Magic
No Magic
 
Posts: 382
Posts Rating:29
Joined: Thu Jun 23, 2011 12:47 am

Re: How to detect any error after run generate.bat?

Postby zzhou@solielcom.com » Thu Aug 22, 2019 1:10 pm

Hi, thanks for the patch. I downloaded and tried to run on a unix box ( I added the exit at the end), but the script never exit . I checked the output, it does generate output though.
I will attach the cea.log here . I do not see any error message. Not sure why it hangs, what it waits for. We have a bunch of projects hosted on TWC, it seems this is the only one
hangs when we run the generate.sh script. since you only provided the generateandexit.bat , I copied my generateandexit.sh here as well. Also, the command line I am running is like this:

generateandexit.sh -server "server:3579" -login "userr" -password "pwd" -servertype "twcloud" -strategy "com.nomagic.magicdraw.magicreport.CommandLine2" -project "EPPC_Solution_Architecture_Demo_04192019" -output "/root/report/EPPC_Solution_Architecture_Demo_04192019_webpublisher.html" -template "Web Publisher 2.0" -package "Model" > t

Also, is there any other way I can decide if a project report is done? Like is there any specific string in the cea.log file we can look for for the indication of the report generating is done? Or, can we look at the report output directory for some indication?

Thanks!

zzhou
You do not have the required permissions to view the files attached to this post.
zzhou@solielcom.com
Forum Newbie
Forum Newbie
 
Posts: 10
Posts Rating:0
Joined: Mon Jul 01, 2019 1:30 pm

Re: How to detect any error after run generate.bat?

Postby sarawut_w » Fri Aug 23, 2019 2:49 am

Hello,

1. Please place this generateandexit.sh file at "{MD}\plugins\com.nomagic.magicdraw.reportwizard".
generateandexit.zip

2. Restart CEA
3. Clear the log file
4. Generate the report
5. Send the log to us

Best regards,
Sarawut
You do not have the required permissions to view the files attached to this post.
sarawut_w
No Magic
No Magic
 
Posts: 382
Posts Rating:29
Joined: Thu Jun 23, 2011 12:47 am

Re: How to detect any error after run generate.bat?

Postby zzhou@solielcom.com » Fri Aug 23, 2019 6:38 am

Thanks Sarawut! I did it. Here is the new log.

Thanks again!

Zhishuai
You do not have the required permissions to view the files attached to this post.
zzhou@solielcom.com
Forum Newbie
Forum Newbie
 
Posts: 10
Posts Rating:0
Joined: Mon Jul 01, 2019 1:30 pm

Re: How to detect any error after run generate.bat?

Postby sarawut_w » Mon Aug 26, 2019 9:06 pm

Hello Zhishuai,

Thank you for the log file.
There is no error in the log, It worked until it until it was trying to generate the Generic Table, then the report generation was terminated.

Please help us clarify these questions:
1. Is your main issue report generation hung?
2. When you use the same project and template as 1), generate report with generateandexit.bat, does this issue occur?
3. When you use the same project and template as 1), generate report with generate.bat or generate.sh, does this issue occur?
4. If you generate report with generateandexit.sh, from built-in projects, such as class diagram.mdzip, activity diagram.mdzip, etc. does this issue occur?

Best regards,
Sarawut
sarawut_w
No Magic
No Magic
 
Posts: 382
Posts Rating:29
Joined: Thu Jun 23, 2011 12:47 am

Next

Return to Report Engine

Who is online

Users browsing this forum: No registered users and 0 guests