-----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<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? 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