When you want to set up and use local logging for Java DFC classes here is an easy procedure.  Not only will you have local logging but after your code is deployed to application server (Java Method Server, Tomcat, WebLogic, etc.) the same logging setup can be configured there, too. An advantage is that you needn't use System.out statements locally and then change to log4j logging for server deployment but just configure once for log4j type logging.

 

This applies to Composer 6.5 but is probably back-compatible to other versions of Composer plus Eclipse 3x.

 

On your local developer's PC:

 

1. edit log4j.properties in c:\documentum\config or similar path. This assumes you have c:\documentum\config as a Linked Folder in your Composer project. See my other entries on setting up Composer for DFC projects.

2. add these lines or similar to log4j.properties file. See documentation on log4j logging formats if you wish to customize beyond what is shown below.

 

#----------------Custom Logging for Application called application_delete_notify -------------------------------------------

log4j.logger.application_delete_notify=DEBUG,application_delete_notify

log4j.appender.application_delete_notify=org.apache.log4j.RollingFileAppender

log4j.appender.application_delete_notify.File=c\:/Documentum/logs/application_delete_notify.log

log4j.appender.application_delete_notify.MaxFileSize=100MB

log4j.appender.application_delete_notify.layout=org.apache.log4j.PatternLayout

log4j.appender.application_delete_notify.layout.ConversionPattern=%d{HH\:mm\:ss} %p %c %m  %n

 

3. in your java classes be sure to import Logger:

 

import com.documentum.fc.common.DfLogger;

 

4. In your dfc code make sure you reference the logger with a statement something like this:

 

DfLogger.info("application_delete_notify", "DCTMLogin.doSession...session object is..." + sess,null,null);

 

Where:

 DfLogger.info = the logging level (could have used other logging levels like "debug")

 application_delete_notify = name of custom logger created in log4j.properties file

 DCTMLogin.doSession...session object is... = this is an arbitrary debugging string. You may put anything here. I wrote name of class, name of method, and outputting the hex value for a session object.

 

 + sess,null,null = "sess" is the variable outputted, and the logging format indicates you must place two null at the statement's end as shown. You could output result of any variable that's in scope as long as it's before the comma as shown.

 

 

 

5.  After running code log file will appear in location you designated above on the third line of the log4j.properties file, in other words in this path:

 

c:/Documentum/logs/application_delete_notify.log