JavaBlog.fr / Java.lu DEVELOPMENT,Documentum,ECM ECM-Documentum : Writing in log of method/job execution

ECM-Documentum : Writing in log of method/job execution

Hello,
During the implementation of a custom method in Documentum (via Composer), we have the possibility to generate a specific log (dm_document stored in DCTM) for each method’s execution via a PrintWriter object provided by Documentum DFC:

public class MyJavaBlogMethod extends DfSingleDocbaseModule implements IDfMethod {
	// --------------------------------------------------------------- PRIVATE VARIABLES
	// Writer to JOB SAVE_RESULTS file
	private MethodHelper methodHelper = null;
	
	// --------------------------------------------------------------- PUBLIC METHODS
	public int execute(Map args, PrintWriter writer) throws Exception {
		this.pw = writer;
		//...
		//...
		pw.println(ownerClass +" - OUT - " + s + (t==null?"":" - Throwable="+t.getMessage()));
		//...
		//...
	}
}

 
During the execution or calling of method, it is necessary to precise the save_results=true parameter :

EXECUTE do_method WITH method = 'HUO_MyJavaBlogMethod', save_results=true, arguments ='-user_name huouser -docbase_name MY_DOCBASE_DEV -password my_pwd_4_huo -myparameter1 "VALUE1, VALUE2" -myparameter2 "090xxxx47, 090yyyyybbd " '

 
The execution of a method returns result (or/and result_doc_id) field, this information corresponds to the r_object_id of dm_document of log file. Without the save_results=true parameter, the result field is equal to 0.
 
Via Documentum API function getfile on the result (or/and result_doc_id) returned by the method’s execution, get the log file:

API> getfile,c,090xxxxc5
...
C:\APP\dqMan\dmcl\DOC_BASE_ID\Result0f5c6823.txt 

 
This TXT file contains the log of method’s execution:

class com.huo.lu.emc.method.MyJavaBlogMethod - OUT -  - LOG - MyJavaBlogMethod.execute(), pw=java.io.PrintWriter@6e1b3efc
class com.huo.lu.emc.method.MyJavaBlogMethod - OUT - nkeys: 5
class com.huo.lu.emc.method.MyJavaBlogMethod - OUT - parsing key: user_name
class com.huo.lu.emc.method.MyJavaBlogMethod - OUT - param user_name=huouser 
class com.huo.lu.emc.method.MyJavaBlogMethod - OUT - parsing key: docbase_name
class com.huo.lu.emc.method.MyJavaBlogMethod - OUT - param docbase_name=MY_DOCBASE_DEV
class com.huo.lu.emc.method.MyJavaBlogMethod - OUT -  - LOG -  ***************************** Start of execution report for MyJavaBlogMethod method/job
class com.huo.lu.emc.method.MyJavaBlogMethod - OUT -  - LOG -  ******* Number of total documents to process : 2
class com.huo.lu.emc.method.MyJavaBlogMethod - OUT -  - LOG -  ******* Number of total documents processed without error: 2
class com.huo.lu.emc.method.MyJavaBlogMethod - OUT -  - LOG -  ******* Number of documents not processed due to functionnal error : 0
class com.huo.lu.emc.method.MyJavaBlogMethod - OUT -  - LOG -  ******* Following all functionnal warning messages concerning the documents: 
class com.huo.lu.emc.method.MyJavaBlogMethod - OUT -  - LOG -  ***************************** End of execution report for MyJavaBlogMethod method/job
class com.huo.lu.emc.method.MyJavaBlogMethod - OUT -  - LOG - MyJavaBlogMethod.Execute() returning : 2

 
More, the logs of job’s execution via DA or djMan are stored in the dedicated folder in the cabinet /Temp/Jobs/Huo_MyJavaBlogJob:

SELECT * FROM dm_document where folder('/Temp/Jobs/Huo_MyJavaBlogJob') ORDER BY r_creation_date DESC;

 
And the logs of method’s execution via DA or DQL are stored in the root of /Temp/ cabinet:

SELECT * FROM dm_document WHERE folder('/Temp') and object_name LIKE '%MyJavaBlogJob%' ORDER BY r_creation_date DESC;

 
 
Study Case:
After exécutions, the logs are missing from the classic directory on the server filesystem [DCTM_INSTALL_FOLDER]\dba\log\[DOCBASE_ID]\sysadmin, however, there are logs in the dedicated folder in the cabinet /Temp/Jobs/Huo_MyJavaBlogJob and /Temp/ cabinet:

DQL>SELECT  * FROM dm_document WHERE folder('/Temp') and object_name LIKE '%MyPerso%' ORDER BY r_creation_date DESC;
...
09xxxxxxxxxxxc10	Result.JavaLu_MyPersoMethod	Result of dm_method(JavaLu_MyPersoMethod) with status code (0)	Result of dm_method(JavaLu_MyPersoMethod) with command line: -method_verb JavaLu_MyPersoModule -__dm_docbase__ MY_DOCBASE_DEV -__dm_server_config__ MY_DOCBASE_DEV  -user_name myuser ....		myuser
...
09xxxxxxxxxxxbe6	Result.JavaLu_MyPersoMethod	Result of dm_method(JavaLu_MyPersoMethod) with status code (0)	Result of dm_method(JavaLu_MyPersoMethod) with command line: -method_verb JavaLu_MyPersoModule -__dm_docbase__ MY_DOCBASE_DEV -__dm_server_config__ MY_DOCBASE_DEV -nbdocsproccess 100....		myuser



DQL>SELECT * FROM dm_document where folder('/Temp/Jobs/JavaLu_MyPersoJob') ORDER BY r_creation_date DESC;
....
09xxxxxxxxxxxc0b	01/28/2016 12:25:43 PM JavaLu_MyPersoJob	Result of dm_method(JavaLu_MyPersoMethod) with status code (0)	Result of dm_method(JavaLu_MyPersoMethod) with command line: -method_verb JavaLu_MyPersoModule -__dm_docbase__ MY_DOCBASE_DEV -__dm_server_config__ MY_DOCBASE_DEV  -user_name myuser ....		myuser
...
09xxxxxxxxxxxb8e	01/28/2016 11:48:12 AM JavaLu_MyPersoJob	Result of dm_method(JavaLu_MyPersoMethod) with status code (0)	Result of dm_method(JavaLu_MyPersoMethod) with command line: -method_verb JavaLu_MyPersoModule -__dm_docbase__ MY_DOCBASE_DEV -__dm_server_config__ MY_DOCBASE_DEV  -user_name myuser ....		myuser

 
Where are store these log files?
In DA, the dm_filestore ‘filestore_01’ use the dm_location ‘storage_01’ whose the path is \\MYFILESSERVER1\data\MY_DOCBASE_DEV\content_storage_01. So, to retrieve the storage location given the r_object_id of a dm_sysobject use the getpath API method. For example in IAPI:

API> getpath,c,09xxxxxxxxxxxc0b
...
\\MYFILESSERVER1\data\MY_DOCBASE_DEV\content_storage_01\000xxxxx\12\34\aa\bb.txt</code>

That’s all!!!

Huseyin OZVEREN

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

Related Post