I have an app that can take a war file and deploy it with embedded tomcat .5.6. 
So, for each uploaded war file I do the following
Tomcat tomcat = new Tomcat();
tomcat.setPort(port);
File catalinaHome = new File(TOMCAT_DIR + port);
catalinaHome.mkdirs();
File webapp = new File(TOMCAT_DIR + port + "\\webapps<file:///\\webapps>");
webapp.mkdir();
tomcat.setBaseDir(catalinaHome.getAbsolutePath());

try {
    File war = new File("myapp.war"); //the given war file
    StandardContext context = (StandardContext) tomcat.addWebapp("/myapp", 
war.getAbsolutePath());
    context.setAntiResourceLocking(true);
    tomcat.start();
} catch (Exception e) {
    e.printStackTrace();
}

I don't have any idea how can I redirect the output.
I read that tomcat embedded log to System.out, and I was able to redirect to 
file with:
PrintStream out = new PrintStream(new FileOutputStream("output.txt"));
System.setOut(out);
but redirect all output, and I want something that log to a different file for 
each tomcat instance that I run.
Any solution that I found so far don't resolve my problem.
So, how can I separate output for each tomcat instance?
Thanks


The information in this email is confidential and may be legally privileged. It 
is intended solely for the addressee. Any opinions expressed are mine and do 
not necessarily represent the opinions of the Company. Emails are susceptible 
to interference. If you are not the intended recipient, any disclosure, 
copying, distribution or any action taken or omitted to be taken in reliance on 
it, is strictly prohibited and may be unlawful. If you have received this 
message in error, do not open any attachments but please notify the Endava 
Service Desk on (+44 (0)870 423 0187), and delete this message from your 
system. The sender accepts no responsibility for information, errors or 
omissions in this email, or for its use or misuse, or for any act committed or 
omitted in connection with this communication. If in doubt, please verify the 
authenticity of the contents with the sender. Please rely on your own virus 
checkers as no responsibility is taken by the sender for any damage rising out 
of any bug or virus infection.

Endava Limited is a company registered in England under company number 5722669 
whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United 
Kingdom. Endava Limited is the Endava group holding company and does not 
provide any services to clients. Each of Endava Limited and its subsidiaries is 
a separate legal entity and has no liability for another such entity's acts or 
omissions.

Reply via email to