Service Virtualization

Expand all | Collapse all

How to customize the java class using the _logger () function

  • 1.  How to customize the java class using the _logger () function

    Posted Aug 29, 2017 11:45 AM

    How to customize the java class using _logger () function, need to import what package



  • 2.  Re: How to customize the java class using the _logger () function

    Posted Aug 29, 2017 11:48 AM

    need help



  • 3.  Re: How to customize the java class using the _logger () function

    Posted Aug 29, 2017 02:58 PM

    please .help



  • 4.  Re: How to customize the java class using the _logger () function
    Best Answer

    Posted Aug 29, 2017 05:49 PM

    Hello ChenJY,

     

    Can you clarify what kind of Java class you are creating? For example, are you trying to create a Java class that extends one of DevTest's SDK base classes, such as a custom Data Protocol Handler for a virtual service or a custom Test step for Application Test?

     

    If this is the case, and you are trying to import the Logger class to log or output debug to a log file, then you'll need to import the following class and package and typically declare your Logger like the following:

     

    import org.apache.log4j.Logger;

     

    public class MyCustomDPH extends DataProtocol {

        private static final Logger log = Logger.getLogger(MyCustomDPH.class);

     

        ....

    }



  • 5.  Re: How to customize the java class using the _logger () function

    Posted Aug 30, 2017 04:26 PM

    ths William,  i am trying to create a Java class  of custom Test step for Application Test



  • 6.  Re: How to customize the java class using the _logger () function

    Posted Aug 30, 2017 05:54 PM

    Hi ChenJY, in that case what I posted earlier is exactly what you need to do.