<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: how to print stacktrace in log using logging in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-to-print-stacktrace-in-log-using-logging/qaa-p/5662162#M2099791</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ya it worked for me also. but still it is writing data to location created for my application and also in ./log folder in trc file. I don't want to put it to ./log in trc file. I want to write only in location created for my application&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kavita&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 May 2009 14:34:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-29T14:34:41Z</dc:date>
    <item>
      <title>how to print stacktrace in log using logging</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-print-stacktrace-in-log-using-logging/qaq-p/5662160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All , &lt;/P&gt;&lt;P&gt;            I am using logging in my webdynpro application &lt;/P&gt;&lt;P&gt;I hv written following java class for logging &lt;/P&gt;&lt;P&gt;***************************************java class Starts *******************************&lt;/P&gt;&lt;P&gt;public class ReferenceApplicationEJBLogger {&lt;/P&gt;&lt;P&gt;	private static final Location LOCATION = Location.getLocation("com.apl");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	   private static final Category CATEGORY = Category.getCategory(Category.APPLICATIONS, "Reference Application");&lt;/P&gt;&lt;P&gt;   static{&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	      LOCATION.setMinimumSeverity(CATEGORY, Severity.INFO);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	      LOCATION.setMaximumSeverity(CATEGORY, Severity.ALL);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	      CATEGORY.addLog(new FileLog("./log/application/hrhelpdesk/edmProject.%g.trc"));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	   }&lt;/P&gt;&lt;P&gt;    public static void logException (Exception eMessage){&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	      logThrowable(eMessage);&lt;/P&gt;&lt;P&gt;	      eMessage.printStackTrace();&lt;/P&gt;&lt;P&gt;	     &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	    }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	    public static void logThrowable (Throwable eMessage){&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	      CATEGORY.logThrowableT(Severity.WARNING, LOCATION, eMessage.getLocalizedMessage(), eMessage);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	    }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	    &lt;/P&gt;&lt;P&gt;    public static void logWarning (String logWarning, Exception eMessage) {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	      CATEGORY.warningT(LOCATION, logWarning, new Object[]{eMessage});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	    }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	    public static void logInfo (String logString){&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	      CATEGORY.infoT(LOCATION, logString);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	    }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	    &lt;/P&gt;&lt;P&gt;	    public static void logWarn (String logString){&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	      CATEGORY.warningT(LOCATION, logString);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	    }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***********************************Java class ends here **********************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and inside my webdynpro applicaiton i have written following code in side catch block&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;ReferenceApplicationEJBLogger.logInfo("Error occured in application" );&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;log is getting written in to defined locaiton ./log/application/hrhelpdesk/edmProject.%g.trc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;but i also want to print e.printStackTrce() in above mentioned location along with message "Error occured in application".&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to go about it ? Thnx in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kavita&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2009 05:08:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-print-stacktrace-in-log-using-logging/qaq-p/5662160</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-28T05:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to print stacktrace in log using logging</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-print-stacktrace-in-log-using-logging/qaa-p/5662161#M2099790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let me understand first, are you looking at printing the complete exception log?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;catch (Exception e) {&lt;/P&gt;&lt;P&gt;          StringWriter sw = new StringWriter();&lt;/P&gt;&lt;P&gt;          PrintWriter pw = new PrintWriter(sw);&lt;/P&gt;&lt;P&gt;          e.printStackTrace(pw);&lt;/P&gt;&lt;P&gt;          System.out.println(sw.toString().toUpperCase());&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tested, it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nitin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Nitin Mahajan on May 28, 2009 9:51 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2009 17:42:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-print-stacktrace-in-log-using-logging/qaa-p/5662161#M2099790</guid>
      <dc:creator>nitin_mahajan2</dc:creator>
      <dc:date>2009-05-28T17:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to print stacktrace in log using logging</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-print-stacktrace-in-log-using-logging/qaa-p/5662162#M2099791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ya it worked for me also. but still it is writing data to location created for my application and also in ./log folder in trc file. I don't want to put it to ./log in trc file. I want to write only in location created for my application&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kavita&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2009 14:34:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-print-stacktrace-in-log-using-logging/qaa-p/5662162#M2099791</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-29T14:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to print stacktrace in log using logging</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-print-stacktrace-in-log-using-logging/qaa-p/5662163#M2099792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The standard log files content is controlled by server. For that you will have to setup in Visual admin log service. I dont remember the name of the service, but there you can set the logging level to info/error etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nitin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Jun 2009 20:50:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-print-stacktrace-in-log-using-logging/qaa-p/5662163#M2099792</guid>
      <dc:creator>nitin_mahajan2</dc:creator>
      <dc:date>2009-06-01T20:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to print stacktrace in log using logging</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-print-stacktrace-in-log-using-logging/qaa-p/5662164#M2099793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thnx. i will try n let u know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kavita&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jun 2009 11:16:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-print-stacktrace-in-log-using-logging/qaa-p/5662164#M2099793</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-04T11:16:00Z</dc:date>
    </item>
  </channel>
</rss>

