Hi,
Is it possible to replace the new line character with the HTML tag <br>.
For logging I'm printing the stackTrace of an exception to a log file. I'm also printing this to the browser.
In the log file the stackTrace is displayed nicely, but in the browser it is displayed as one string.
I'm doing it like this:
( x = exception )
OutputStream buf = new ByteArrayOutputStream();
PrintStream p = new PrintStream(buf);
x.printStackTrace(p);
strErrorDetails = buf.toString();
p.close();
In the log file it's displayed like this:
java.lang.NullPointerException
at be.belgacom.mobile.display.CampaignContacts.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sssw.srv.busobj.AgoFilterChain.doServlet(AgoFilterChain.java:396)
at com.sssw.srv.busobj.AgoFilterChain.doFilter(AgoFilterChain.java:182)
at com.sssw.srv.resources.AgWarResource.service(AgWarResource.java:629)
at com.sssw.srv.resources.AgWarURLResource.perform(AgWarURLResource.java:115)
at com.sssw.srv.http.httpd.perform(httpd.java:5632)
at com.sssw.srv.http.Client.processRequest(Client.java:902)
at com.sssw.srv.http.Client.loop(Client.java:1268)
at com.sssw.srv.http.Client.runConnection(Client.java:1484)
at com.sssw.srv.http.Client.run(Client.java:1432)
at java.lang.Thread.run(Thread.java:479)
In the browser like this:
java.lang.NullPointerException at be.belgacom.mobile.display.CampaignContacts.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.sssw.srv.busobj.AgoFilterChain.doServlet(AgoFilterChain.java:396) at com.sssw.srv.busobj.AgoFilterChain.doFilter(AgoFilterChain.java:182) at com.sssw.srv.resources.AgWarResource.service(AgWarResource.java:629) at com.sssw.srv.resources.AgWarURLResource.perform(AgWarURLResource.java:115) at com.sssw.srv.http.httpd.perform(httpd.java:5632) at com.sssw.srv.http.Client.processRequest(Client.java:902) at com.sssw.srv.http.Client.loop(Client.java:1268) at com.sssw.srv.http.Client.runConnection(Client.java:1484) at com.sssw.srv.http.Client.run(Client.java:1432) at java.lang.Thread.run(Thread.java:479)
Is it possible to display this on the browser the same as in the log file.
Thanks for any assistance.
Tijs
Is it possible to replace the new line character with the HTML tag <br>.
For logging I'm printing the stackTrace of an exception to a log file. I'm also printing this to the browser.
In the log file the stackTrace is displayed nicely, but in the browser it is displayed as one string.
I'm doing it like this:
( x = exception )
OutputStream buf = new ByteArrayOutputStream();
PrintStream p = new PrintStream(buf);
x.printStackTrace(p);
strErrorDetails = buf.toString();
p.close();
In the log file it's displayed like this:
java.lang.NullPointerException
at be.belgacom.mobile.display.CampaignContacts.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sssw.srv.busobj.AgoFilterChain.doServlet(AgoFilterChain.java:396)
at com.sssw.srv.busobj.AgoFilterChain.doFilter(AgoFilterChain.java:182)
at com.sssw.srv.resources.AgWarResource.service(AgWarResource.java:629)
at com.sssw.srv.resources.AgWarURLResource.perform(AgWarURLResource.java:115)
at com.sssw.srv.http.httpd.perform(httpd.java:5632)
at com.sssw.srv.http.Client.processRequest(Client.java:902)
at com.sssw.srv.http.Client.loop(Client.java:1268)
at com.sssw.srv.http.Client.runConnection(Client.java:1484)
at com.sssw.srv.http.Client.run(Client.java:1432)
at java.lang.Thread.run(Thread.java:479)
In the browser like this:
java.lang.NullPointerException at be.belgacom.mobile.display.CampaignContacts.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.sssw.srv.busobj.AgoFilterChain.doServlet(AgoFilterChain.java:396) at com.sssw.srv.busobj.AgoFilterChain.doFilter(AgoFilterChain.java:182) at com.sssw.srv.resources.AgWarResource.service(AgWarResource.java:629) at com.sssw.srv.resources.AgWarURLResource.perform(AgWarURLResource.java:115) at com.sssw.srv.http.httpd.perform(httpd.java:5632) at com.sssw.srv.http.Client.processRequest(Client.java:902) at com.sssw.srv.http.Client.loop(Client.java:1268) at com.sssw.srv.http.Client.runConnection(Client.java:1484) at com.sssw.srv.http.Client.run(Client.java:1432) at java.lang.Thread.run(Thread.java:479)
Is it possible to display this on the browser the same as in the log file.
Thanks for any assistance.
Tijs