RE: Separate and Redirect Tomcat Embedded 8.5.6 Log

2017-01-25 Thread Costin Giorgian Papuc
Hi Chris,

Thanks for your answer.
But this seems to not change anything.
It's there a way to get an InputStream() for each context? Or set a logger or 
something?
From what I saw I can only getLogger() but I cant add a FileHandler to this.

Costin

-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net]
Sent: Tuesday, January 24, 2017 12:30 AM
To: Tomcat Users List <users@tomcat.apache.org>
Subject: Re: Separate and Redirect Tomcat Embedded 8.5.6 Log

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Costin,

On 1/20/17 5:39 AM, Costin Giorgian Papuc wrote:
> 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");
> 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?

Try setting swallowOutput="true" [1] for each of the contexts you deploy .

- -chris

[1] https://tomcat.apache.org/tomcat-8.0-doc/config/context.html
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYhoQAAAoJEBzwKT+lPKRYp+QP/2CxRxua+yW1riHubZilKoy/
R3cDpMQuN7UIOIsgr5ImO8ST7/vAdAkvXMB1bastJ5Btbtc6+K5hdv6HGQb86fT7
aKsut81O3VzBuwBiLIkhyjEDxAT3WU3WVS7BY/hnoDvVeRRS98Kat0tuzJZEPT/e
K8NFnwU7x7jCgI+ruf888O0ukhib1t/9DXjuY/fW9h0moJJDttbo8D6//Dh9H2zd
YvO6n7yIIIAs5FHmJIH4RwP7xOqaMDStGZBxi1cqkaZOcp4ZeCdEi0kekQwhCSK+
bPZ1zNp6fdOYfVIWhAqic44CUSDZmdWMNp3KZ5Ei2/VFllpE+lDYaTvS9TfyEP+n
XxkW03zEFm9QHVIo/35Jbp3mj7YnuJpjvnLOCWrWEvxas+omwJZGbTKlQRNHVTi/
Ez2uKUcJoTfvf9UXqdFDDSncnL7J9YcN7mp1M5tqCxiVkokAZWQs272WDpghNMdl
4Y22rjJJqnRnlr1UpXz/+RHzInl2Jt8yEzC4Ta8zBv1urSSucYQwbTHkNhLerZqT
0Kq4O+OaZEU0sbrG+iHPKCccoIr3i/vpN306F9yCSdSA1aLlWeJqwwL0184JzEXm
pgS1FMDLCLHeRLl6eVhMWegAful13ABQ3DCVayLmR2/a3S5kq484V2OhLsgeAKxH
8iim5GKxss+o/JHB6W89
=qtf5
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


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.


Re: Separate and Redirect Tomcat Embedded 8.5.6 Log

2017-01-23 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Costin,

On 1/20/17 5:39 AM, Costin Giorgian Papuc wrote:
> 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"); 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?

Try setting swallowOutput="true" [1] for each of the contexts you deploy
.

- -chris

[1] https://tomcat.apache.org/tomcat-8.0-doc/config/context.html
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYhoQAAAoJEBzwKT+lPKRYp+QP/2CxRxua+yW1riHubZilKoy/
R3cDpMQuN7UIOIsgr5ImO8ST7/vAdAkvXMB1bastJ5Btbtc6+K5hdv6HGQb86fT7
aKsut81O3VzBuwBiLIkhyjEDxAT3WU3WVS7BY/hnoDvVeRRS98Kat0tuzJZEPT/e
K8NFnwU7x7jCgI+ruf888O0ukhib1t/9DXjuY/fW9h0moJJDttbo8D6//Dh9H2zd
YvO6n7yIIIAs5FHmJIH4RwP7xOqaMDStGZBxi1cqkaZOcp4ZeCdEi0kekQwhCSK+
bPZ1zNp6fdOYfVIWhAqic44CUSDZmdWMNp3KZ5Ei2/VFllpE+lDYaTvS9TfyEP+n
XxkW03zEFm9QHVIo/35Jbp3mj7YnuJpjvnLOCWrWEvxas+omwJZGbTKlQRNHVTi/
Ez2uKUcJoTfvf9UXqdFDDSncnL7J9YcN7mp1M5tqCxiVkokAZWQs272WDpghNMdl
4Y22rjJJqnRnlr1UpXz/+RHzInl2Jt8yEzC4Ta8zBv1urSSucYQwbTHkNhLerZqT
0Kq4O+OaZEU0sbrG+iHPKCccoIr3i/vpN306F9yCSdSA1aLlWeJqwwL0184JzEXm
pgS1FMDLCLHeRLl6eVhMWegAful13ABQ3DCVayLmR2/a3S5kq484V2OhLsgeAKxH
8iim5GKxss+o/JHB6W89
=qtf5
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org