title: How to do logging of spark Dataset printSchema in info/debug level in spark- java project
body: <p>Trying to covert my spark scala project into spark-java project.
  I have a logging in scala as below</p>
  
  <pre><code>import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
      class ClassName{
        val logger  = LoggerFactory.getLogger("ClassName")
        ...
        val dataframe1 = ....///read dataframe from text file.
        ...
  
        logger.debug("dataframe1.printSchema : \n " + dataframe1.printSchema; //this is working fine.
      }
  </code></pre>
  
  <p>Now I am trying to write it in java 1.8 as below</p>
  
  <pre><code>public class ClassName{
  
      public static final Logger logger  = oggerFactory.getLogger("ClassName"); 
        ...
       Dataset&lt;Row&gt; dataframe1 = ....///read dataframe from text file.
       ...
  
       logger.debug("dataframe1.printSchema : \n " + dataframe1.printSchema()); //this is not working 
  
  }
  </code></pre>
  
  <p>I tried several ways but nothing worked to log printSchema in debug/info mode.</p>
  
  <p>dataframe1.printSchema() // this actually returning void hence not able to append to string.</p>
  
  <p>How actually logging is done spark-java production grade projects ?
  What is the best approach I need to follow to log in debugging?</p>
  
  <p>How to handle the above scenario? i.e. log.debug( dataframe1.printSchema() ) in java ?</p>