Redirecting Tomcat output

I am using Tomcat 5.0.28.
My code uses the System.out.println( ) statements.
However the output is redirected to the stdout file in Logs folder in Tomcat installation directory.
I intend to see the output on the console.How can I redirect the outtput to the console and not to the stdout file?
Any suggestion would be appreciated.

File f = new File(logFile);
printStream = new PrintStream(new BufferedOutputStream(new FileOutputStream(f)), true);
System.setErr(printStream);
System.setOut(printStream);
System.out.println("Log started: " + new java.util.Date());When the virtual machine starts, System.out, a singleton object of type PrintStream, is hooked up to the console. You can then call print() and println() on this stream and have it show up there. Using System.setOut(), you can change this object and have it point somewhere else, such as a file. In this case, the variable log�File holds this location and becomes the output for the application.

Similar Messages

  • How to redirect tomcat's (not in jwsdp) output  to catalina.out

    how to redirect tomcat's (not in jwsdp) output from consolee to catalina.out

    Finally we solve this.
    In startup.bat we've changed string
    call "%EXECUTABLE%" start %CMD_LINE_ARGS%
    to
    call "%EXECUTABLE%" run %CMD_LINE_ARGS% 1>..\logs\catalina.out 2>..\logs\catalina-err.out
    (the above in one string)
    May be someone know something better?

  • Possible to redirect JSP output?

    Is it possible to redirect the output of a JSP either directly to a printer or directly to a File object? I would like to write a report template using JSP and be able to display it via a browser (so far so good, that's what JSP does) but I'd also like to take the same output that the JSP generates and either print it directly (as in printing many many reports without having to run each one in a browser and click the browser print button) AND to be able to email the report to a client.
    Each of these means I need to redirect the output of a JSP. I couldn't find anything in this forum about that. Is this even possible?
    Thank you in advance for your answers.

    The problem with using a new URLConnection is that the current session is not applied to the JSP page as desired.
    For those using Tomcat 4, which implements the Servlet 2.3 spec, this page describes how to replace the output stream of a servlet with your own.
    http://www-106.ibm.com/developerworks/java/library/j-tomcat/
    The example implements a character replacement mechanism. Using a filter and a wrapper. I modified this example to redirect the output stream to a file, which allowed me to then e-mail the output of a JSP. I did this by only using the wrapper classes.
    Here are the relavant excerpts from my code
    //Inside the servlet:
    //{snip}...
    String sFileName = "e:\\temp\\email\\temp.html";
    RedirectTextWrapper rTW =
    new RedirectTextWrapper(response, sFileName);
    gotoPage(sAddress, request, rTW);
    //{snip}...
    //Supporting classes:
    class RedirectTextStream
    extends ServletOutputStream {
    private OutputStream intStream;
    private boolean closed = false;
    public RedirectTextStream(String sFileName) {
    try{
    intStream = new FileOutputStream(sFileName);
    }catch(FileNotFoundException e){
    e.printStackTrace();
    public void write(int i)
    throws java.io.IOException {
    intStream.write(i);
    public void close()
    throws java.io.IOException {
    if (!closed) {
    intStream.close();
    closed = true;
    public void flush() throws java.io.IOException {
    intStream.flush();
    class RedirectTextWrapper
    extends HttpServletResponseWrapper {
    private PrintWriter tpWriter;
    private RedirectTextStream tpStream;
    public RedirectTextWrapper(ServletResponse inResp,
    String sFileName)
    throws java.io.IOException {
    super((HttpServletResponse) inResp);
    tpStream = new RedirectTextStream(sFileName);
    tpWriter = new PrintWriter(tpStream);
    public ServletOutputStream getOutputStream()
    throws java.io.IOException {
    return tpStream;
    public PrintWriter getWriter()
    throws java.io.IOException {
    return tpWriter;
    }

  • How to redirect the output display on Ultra 5 box.

    Hello,
    Good day to you.
    I have issues with redirecting display output to my console server (which is configured with cyclades switch) on a newly installed solaris 10, Ultra 5 box.
    I could access the output display on the monitor when I connect it directly to the serial port. But I also have my parallel port connected to cyclades switch which is primarily being used for accessing multiple servers thro' one single console server.
    When I try to access my ultra 5 box thro' console server, the display not getting redirected over there..I did checked the port from cyclades switch front, it did work well with other machines.
    Looks like some work needs to be done at Ultra 5 box level so that the parallel port can send output signals to the respective port on cyclades switch and consequently to the console server.
    Any thoughts ??
    Thanks.

    Hi,
    Good day to you.
    Apologize for quoting "Parallel" port. It is a in-built 25pin serial connector placed next to regular 15 pin serial port.
    Just to make a point here, this 25 pin serial connector has an external converter attached with other side having RJ45 jack.
    CAT5 cable connected between switch port to this RJ45 jack.
    I did tested this converter with another machine and could able to access the display on my console server. So it seems to be the connectivity from serial port to switch port works fine.
    Adding to that, this ultra 5 box with the current connectivity set up was working fine until I rebuild this machine. I was very well accessing this box thro my console server. There was no changes done except rebuilding the operating system.
    I think some work needs to be done at the ultra 5 box level to get this 25pin serial connector to act.
    Thanks.

  • How to redirect standard output/error of a ucb function to matrixx command window

    Is there a way to redirect standard output/error of a ucb function to matrixx command window?
    I know that the recommended way is to use stdwrt or XmathDisplay commands. However, we have some
    libraries that already exists which uses printf calls and I would like to redirect their output
    to the matrixx command window.
    Thanks

    Hi,
    What you need to do is create a printf function that will print the information into a string, then you can use stdwrt to display it in Xmath.
    Then you tell the UCB linking process to compile and link with this version of printf.c
    I am including the printf.c that we used to test the function you needed.
    Hope this helps.
    Attachments:
    printf.c ‏1 KB

  • Redirect standart output to file

    i want to ask how to redirect standart output to file,
    if i have statement like this System.out.println("hello"); i want hello not print in console but print to file
    thx

    Here is sample code for that:
      static{
        try {
          PrintStream obj_ps = new PrintStream(new FileOutputStream("internal.log"));
          System.setOut(obj_ps);
          System.setErr(obj_ps);
        catch (FileNotFoundException ex) {
          JOptionPane.showMessageDialog(null, "Error creating log file", "Error", JOptionPane.ERROR_MESSAGE);
      }

  • Redirecting cmd output to a JTextArea

    can anyone help me, im curious how can the compilers for java e.g.: Netbeans, JCreator, redirect the command promt output to a JTextArea..
    can anyone guide me on what class to look at??
    thanks a lot

    here is a simple class that redirects the standard output to a file called a.txt. you have to look into the class java.class.System. and other i/o classes
    import java.io.PrintStream;
    public class A {
        public A() {
        public static void main(String[] args) throws Exception {
            PrintStream fileOut = new PrintStream("a.txt");
            System.setOut(fileOut);
            for (int i = 0; i < 10; i++) {
                System.out.println(i);
    }for your case where output goes to a textArea you might wanna use a multithreaded solution. redirect your output to a file as above and use the thread to read the file and paste text into your text area. there is other better solution that directly passes data into the textArea. i'll post it if can find it in my code base.

  • How to redirect CELLCLI output to text file

    Hi,
    I would like to redicrect the output of the cellcli command to a text file .
    For example , how to redirect the output of this command to a text file on /tmp
    CellCLI> list metrichistory where objectType = 'CELL' -
    and name = 'CL_TEMP'Thanks

    cellcli has spooling capabilities similar to sqlplus:
    CellCLI> help spool
      Usage:  SPO[OL] [<filename> [ CRE[ATE] | REP[LACE] | APP[END]] | OFF ]
      Purpose: SPOOL <filename>: Direct the results to the file <filename>.
               SPOOL OFF: Turn off the spooling.
               SPOOL: Check the current spooling status.
      Arguments:
        <filename>: The filename where the results will be output.
      Options:
        [APPEND]: If the filename already exists, the following output will
                  be appended to the file. Without this option, the existing file
                  contents will be replaced.
        [CREATE]: If the filename already exists, an error is reported.
        [REPLACE]: If the filename already exists, the contents will be
                  replaced.  This is the default, when no option is provided.
      Examples:
        spool myfile
        spool myfile append
        spool off
        spoolBut if you are trying to script it, it would be easier to just run it command line:
    # cellcli -e "list metrichistory where objectType = 'CELL' and name = 'CL_TEMP'" > /tmp/CL_TEMP.txtAlso look into dcli which allows you to run cellcli commands on one or more cells from a compute node.
    Good luck.

  • Redirecting XSLT output to multiple files

    Hi,
    I am trying to redirect the output of the XSLT into multiple files using
    <xsl:variable name="filename" select="concat(@id,'.xml')" />
    <redirect:write select="$filename">
    </redirect:write>I dont want to hard-code the directory of the $filename in XSL, I want to set it or resolve it programatically in the java code.
    Can you please tell me if this can be done in someway ?

    Aravinda wrote:
    I dont want to hard-code the directory of the $filename in XSL, I want to set it or resolve it programatically in the java code.
    Can you please tell me if this can be done in someway ?You + setParameter + method of your Transformer in java code to set parameters. like below:
    transformer.setParameter("message1", "This is my message to XSLT from Java Class.");
    transformer.setParameter("message2", "Hello XSLT how are you?");
    . . .You can retrieve above parameters in global parameters/variables(must be as child of xsl:stylesheet element in xslt) defined in xslt like below:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:param name="message1"></xsl:param>
         <xsl:variable name="message2"></xsl:variable>
         <xsl:template match="/">
              <xsl:value-of select="$message1"/>     // retrieving message1
              <xsl:value-of select="$message2"/>     // retrieving message2
              <xsl:value-of select="concat($message1,$message2)"/>     // performing concat on message1 and message2
         </xsl:template>
    </xsl:stylesheet>*Cheers
    TYPUROHIT*
    (Tejas Purohit)

  • How to redirect console output while starting server from within IDE

    Hello, i am using Weblogic Workshop IDE. When I start the server, a new cmd shell is launched and the jvm output is displayed in this cmd shell window. How can I redirect this output to show up within the IDE (for instance in the Console view)?
    Problem is that when an error occurs, the cmd window disappears and I cannot tell what the error was.
    Surely there is a way to do this as other IDEs (JBuilder, Rational etc.) allow this.
    Thanks:
    -Sam

    Hi Sam,
    Unfortunately, this feature does not exist in Workshop 9.2
    Regarding your question about redirecting the output, the logs are saved under the domain directory.
    You could also refer to the following section for additional info on redirecting the output to multiple destinations.
    http://e-docs.bea.com/wls/docs90/ConsoleHelp/taskhelp/logging/RedirectJVMOutput.html
    Hope this helps.
    cheers
    Raj

  • Redirect the output of SQL*Plus to the file

    Hi all,
    I have the following command to run:
    sqlplus username/password @myfile.sql
    I don't know how to redirect the output to the file.
    Also in the script myfile.sql I have the defined variable, &VP and
    How can I substitute this variable(&VP) at the run time.
    Thanks,
    JP

    Assumed you like to replace your defined variable VP by number 4. SInce it is posintional parameter,instead of wrinting &VP, write
    VP:=&1
    sqlplus>spool redirect.txt
    sqlplus>@myfile.sql 4
    sqlplus>spool off

  • IS IT POSSIBLE TO REDIRECT THE OUTPUT TO ANOTHER PAGE?

    Hi all,
    Is it possible to redirect the output when I excute my query in iSQL*plus to another predifined html page?
    If yes how do I do this?
    Thanks a mill

    You could do this..just read on..
    It would generate a html page for you...and..so on..!
    In addition to plain text output, the SQL*Plus command-line interface enables you to generate either a complete web page, or HTML output which can be embedded in a web page. You can use SQLPLUS -MARKUP "HTML ON" or SET MARKUP HTML ON SPOOL ON to produce complete HTML pages automatically encapsulated with <HTML> and <BODY> tags.
    By default, data retrieved with MARKUP HTML ON is output in HTML, though you can optionally direct output to the HTML <PRE> tag so that it displays in a web browser exactly as it appears in SQL*Plus. See the SQLPLUS MARKUP Options and the SET MARKUP command for more information about these commands.
    SQLPLUS -MARKUP "HTML ON" is useful when embedding SQL*Plus in program scripts. On starting, it outputs the HTML and BODY tags before executing any commands. All subsequent output is in HTML until SQL*Plus terminates.
    The -SILENT and -RESTRICT command-line options may be effectively used with -MARKUP to suppress the display of SQL*Plus prompt and banner information, and to restrict the use of some commands.
    SET MARKUP HTML ON SPOOL ON generates an HTML page for each subsequently spooled file. The HTML tags in a spool file are closed when SPOOL OFF is executed or SQL*Plus exits.
    You can use SET MARKUP HTML ON SPOOL OFF to generate HTML output suitable for embedding in an existing web page. HTML output generated this way has no <HTML> or <BODY> tags.

  • Redirect SM50 output on unix file

    Hello,
    how can we execute daily SM50 daily and redirect html output on unix file?
    I Tried SE38, execute SM50 succefully, but no way to redirect output of this transaction on a unix file ?
    Thanks in advance.

    Hi majda,
    Hope you are doing good.
    Maybe check /nSM49 and create a OS command using ">>" operator Divyanshu mentioned:
    Restrict Authorizations for Executing External Commands - SAP NetWeaver Application Server ABAP Security Guide - SAP Lib…
    Thank you!
    Kind Regards,
    Hemanth
    SAP AGS

  • Redirect Stand Output & Standard Error

    Hi,
    Is there a way to redirect Standard Output and Standard Error to
    a specific console window? I'm launching several Java applications
    and would like to redirect all Standard Output and Standard Error
    from these application to ONE specific window. My intention is to
    simulate a LOG window where all System.out.println() and
    System.err.println() can be redirected there.
    Thank you in advance

    Well the java console already does what you ask. Simply enable the java console in the control panel (in windows).

  • Runing an exec from class Runtime and redirecting its output ...?..?

    Hello!
    I am trying to run a C exec by using th eRuntime class.
    This works well ...
    But, I want to redirect its output to my transcript.
    This also works with small output (some lines !) ...
    But the out put is up to 3000 lines, my program does
    not continue. It is suspended in a waiting state.
    I suspected that the buffer is filled, but there is still some lines to be written ...?
    Anyone knows this problem and the solution ..?
    Thanks by advance
    Yaz

    You could try something like thisjava.util.List al = new ArrayList();
    try {
         Process p = Runtime.getRuntime().exec("cmd.exe /c dir");
         BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
         String s = "";
         while ((s=br.readLine()) != null) {
              al.add(s);
         ListIterator li = al.listIterator();
         while (li.hasNext()) {
              System.out.println(li.next());
    catch (IOException ioe) {}Mark

Maybe you are looking for

  • Plant info on goods receipt

    Hi gurus We have a situation where a purchase order is created automatically for intercompany stock transfer deliveries. On the PO when we default the plant to be P001. But  the plant on FI doc, created by the goods receipt,  is different than the on

  • MacBook Pro 13" Mid 2009: Fan doesn't kick in

    A week ago, my MBP's fan stopped working. My MBP doesn't have AppleCare so I bought a new fan and replaced it. The new fan has been working like a charm but then I notice that my new fan doesn't kick in when the temperature goes up. It always stays a

  • Acquiring local address for datagram socket created by DatagramChannel.open

    I've found that when I open an anonymous DatagramChannel (i.e. unbound, unconnected), the socket that it creates has no local address info I.e. no local port. Hopefully the example below will explain the problem... import java.nio.channels.DatagramCh

  • What is license count of installing or use O365 Pro plus software per user for Bussiness

    Hi  All, Today in our office given demo of Office 365 usages and license details , but i am little bit confused on licensing. They told we can use Office 365 Pro Plus software into 15 Device ( 5 Windows PC + 5 MAC + 5 Mobile or Tablets). I refereed t

  • Problem accessing BI data in SEM-BSC

    In the scorecard monitor, when I do a check BW data availability, I get the following error:   <b>error occured when starting the parser: timeout during allocate /CPIC-CALL: 'ThSAPCMRCV</b> We are on ECC 6.0 with BI7.0. Any help is appreciated and wo