[D7.2 JMS] location of custom job logs run by JMS

seloum57
seloum57 Member
edited January 16, 2017 in Documentum #1

Hello,

I developed a custom java method which is executed by the Java Method Server (D7.2), and when I launch the job I created, the execution logs are only on the server.log of the jboss, the file which is created in /Temp/Jobs/<my_job_name> is empty; how to log into this file (as Documentum-native jobs).  ?

Please note that I'm using System.out.println for logging in my custom job

Tagged:

Best Answer

  • Jeremy Saumen
    Jeremy Saumen Member
    edited January 16, 2017 #2 Answer ✓

    Hi,

    When you are implementing the method public int execute(Map map, PrintWriter printwriter) throws Exception, use the printWriter argument instead of the System.out.

    Example :

    package test;

    import java.io.OutputStream;
    import java.io.PrintWriter;
    import java.util.Map;

    import com.documentum.fc.methodserver.IDfMethod;
    import com.documentum.mthdservlet.IDmMethod;

    public class MyTestMethod implements IDfMethod, IDmMethod {

         private PrintWriter printWriter;

         protected void println(String string) {
              this.printWriter.println(string);
         }

         @Override
         public void execute(Map arg0, OutputStream arg1) throws Exception {
              PrintWriter printWriter = new PrintWriter(arg1);
              try {
                   execute(arg0, printWriter);
              } finally {
                   printWriter.close();
              }
         }

         @Override
         public int execute(Map map, PrintWriter printwriter) throws Exception {
              this.printWriter = new PrintWriter(printwriter, true);
              try {
                   println("This is my log");

              } finally {
                   this.printWriter.close();
              }
              return 0;
         }
    }

Answers

  • Jeremy Saumen
    Jeremy Saumen Member
    edited January 16, 2017 #3 Answer ✓

    Hi,

    When you are implementing the method public int execute(Map map, PrintWriter printwriter) throws Exception, use the printWriter argument instead of the System.out.

    Example :

    package test;

    import java.io.OutputStream;
    import java.io.PrintWriter;
    import java.util.Map;

    import com.documentum.fc.methodserver.IDfMethod;
    import com.documentum.mthdservlet.IDmMethod;

    public class MyTestMethod implements IDfMethod, IDmMethod {

         private PrintWriter printWriter;

         protected void println(String string) {
              this.printWriter.println(string);
         }

         @Override
         public void execute(Map arg0, OutputStream arg1) throws Exception {
              PrintWriter printWriter = new PrintWriter(arg1);
              try {
                   execute(arg0, printWriter);
              } finally {
                   printWriter.close();
              }
         }

         @Override
         public int execute(Map map, PrintWriter printwriter) throws Exception {
              this.printWriter = new PrintWriter(printwriter, true);
              try {
                   println("This is my log");

              } finally {
                   this.printWriter.close();
              }
              return 0;
         }
    }
  • seloum57
    seloum57 Member
    edited January 16, 2017 #4

    Thank U !