Hi Barry,

As an example, we use two different strategies (depending on what we need):

Easy solution:
Create an executable WAR file and configure a normal console logger which 
writes everything to stdout. From there you pipe the log messages to a file of 
your choice. Something like:

exec $JAVA_HOME/bin/java -jar $JAR >> $LOG 2>&1 &

Less easy solution:
Create an eager loading logging configuration service which configures the 
logging system according to your needs (for example output to a data directory 
which is configured via a T5 symbol). Logback for example is easy to configure 
programmatically.

Either way, I strongly recommend to use a centralized system to collect all 
your logs (for example ELK), especially if you consider to distribute your 
application.

Best,
Thilo





Am 28.07.15 14:04 schrieb "Barry Books" unter <trs...@gmail.com>:

>How do you handle logging configuration? At first I used different
>log4j.properties files and specified which one to use on the command line
>but now I often deploy Jenkins in the same Tomcat so I switched to messing
>with the class path to get the right properties file. Neither solution is
>ideal. Anyone come up with anything else?
>
>
>
>On Tuesday, July 28, 2015, Dmitry Gusev <dmitry.gu...@gmail.com> wrote:
>
>> Got it, thank you.
>>
>> This is exactly how we do it currently with standalone tomcat, with one
>> difference -- we implemented our own symbol resolution strategy to get
>> symbols from an external file, instead of passing them all through command
>> line.
>>
>> I was just curios if somebody created some tapestry module with predefined
>> set of tapestry symbols that would start & configure container for us.
>> This way we could still be able to override some symbols when needed as we
>> usually do in tapestry.
>>
>>
>>
>> On Tue, Jul 28, 2015 at 2:11 PM, Thilo Tanner <thilo.tan...@reprisk.com
>> <javascript:;>>
>> wrote:
>>
>> > Hi Dmitry,
>> >
>> > In our case, yes we hardcode and commit those credentials to our
>> > repositories. In my defense, we host all our code in-house and have
>> various
>> > other security measures in place. Database credentials are normally
>> > different from client host to client host and therefore such credentials
>> > are normally useless unless you also have access to this particular host.
>> >
>> > If you prefer to set your credentials directly on your host, use symbols
>> > (as described in the previous email) and make sure to correctly unset the
>> > shell environment variables after application startup. You could do
>> > something like this in your startup script:
>> >
>> > java -Dmyapp.db.username=DB_USERNAME -Dmyapp.db.password=DB_PASSWORD -jar
>> > myapp.jar
>> >
>> > where myapp.db.username and myapp.db.password are user-defined T5
>> symbols.
>> >
>> > Using such a strategy, you can avoid committing your credentials.
>> >
>> > Best,
>> > Thilo
>> >
>> > --
>> > Thilo Tanner
>> > Technology Lead
>> >
>> > Direct +41 43 300 54 42
>> > Mobile +41 79 506 46 36
>> > thilo.tan...@reprisk.com <javascript:;>
>> >
>> > RepRisk AG, Stampfenbachstrasse 42, 8006 Zurich, Switzerland
>> > Tel. +41 43 300 54 40, Fax +41 43 300 54 46
>> > www.reprisk.com
>> >
>> > Follow us on Facebook or Twitter:
>> > www.facebook.com/RepRisk | www.twitter.com/RepRisk
>> >
>> > If you are not the intended recipient, please notify the sender - thank
>> > you.
>> >
>> >
>> >
>> >
>> >
>> >
>> > Am 28.07.15 12:54 schrieb "Dmitry Gusev" unter <dmitry.gu...@gmail.com
>> <javascript:;>>:
>> >
>> > >Hi Thilo,
>> > >
>> > >So you're hardcoding all your staging/production settings in special
>> > >tapestry modules,
>> > >and committing them to the same source code repository as your app's
>> > >codebase, right?
>> > >
>> > >
>> > >On Tue, Jul 28, 2015 at 1:47 PM, Thilo Tanner <thilo.tan...@reprisk.com
>> <javascript:;>>
>> > >wrote:
>> > >
>> > >> Hi Dmitry,
>> > >>
>> > >> To configure our apps, we mainly use what Tapestry offers
>> > out-of-the-box.
>> > >> I recommend to create a dedicated Tapestry module for each of your
>> > >> environments as described here:
>> > >>
>> >
>> http://tapestry.apache.org/configuration.html#Configuration-SettingExecutionModes
>> > >>
>> > >> In such a module, you can override your database settings for example.
>> > >>
>> > >> Additional environment modules are then easy to load via command line.
>> > For
>> > >> example:
>> > >>
>> > >> java -Dtapestry.execution-mode=staging -jar myapp.war
>> > >>
>> > >> Compared to other injection containers, Tapestry’s IOC has lots of
>> > >> built-in features that will help you configuring your application.
>> > Another
>> > >> concept worth mentioning here are Symbols:
>> > >> http://tapestry.apache.org/symbols.html
>> > >> Symbols can be predefined, but also overridden during application
>> > startup
>> > >> (in fact, tapestry.execution-mode is a built-in T5 symbol used to load
>> > >> additional modules during startup)
>> > >>
>> > >> Best,
>> > >> Thilo
>> > >>
>> > >>
>> > >>
>> > >>
>> > >> Am 28.07.15 12:06 schrieb "Dmitry Gusev" unter <
>> dmitry.gu...@gmail.com <javascript:;>
>> > >:
>> > >>
>> > >> >Hi Thilo,
>> > >> >
>> > >> >and how in this case you configure your executable JAR?
>> > >> >
>> > >> >Are you using maven profiles & that war file contains all
>> > configuration,
>> > >> >or you create "universal" binary and provide configuration at runtime
>> > via
>> > >> >system properties or external .properties file?
>> > >> >
>> > >> >I know this should be pretty easy to code, just wondering if there's
>> > >> >anything ready that may be reused without reinventing the wheel.
>> > >> >
>> > >> >On Tue, Jul 28, 2015 at 12:30 PM, Thilo Tanner <
>> > thilo.tan...@reprisk.com <javascript:;>>
>> > >> >wrote:
>> > >> >
>> > >> >> Hi Dmitry,
>> > >> >>
>> > >> >> Yes, we are running T5.4 apps in production by embedding Undertow
>> > >> (Servlet
>> > >> >> container from Wildfly). With Tapestry, such a setup is relatively
>> > easy
>> > >> to
>> > >> >> achieve:
>> > >> >>
>> > >> >> You create an application class that bootstraps the Tapestry filter
>> > in
>> > >> >> Undertow:
>> > >> >>
>> > >>
>> >
>> http://undertow.io/undertow-docs/undertow-docs-1.2.0/index.html#creating-a-servlet-deployment
>> > >> >>
>> > >> >> Such a class will allow you to start your T5 app directly from a
>> main
>> > >> >> method (great for development).
>> > >> >>
>> > >> >> For a deployment, you can use the two following Maven plugins to
>> > >> generate
>> > >> >> „executable WAR files“:
>> > >> >>
>> > >> >> maven-war-plugin
>> > >> >> Define the main class in the manifest file (pointing to your
>> > bootstrap
>> > >> >> class above)
>> > >> >>
>> > >> >> spring-boot-maven-plugin
>> > >> >> The plugin will repackage your WAR file to make it executable (by
>> > using
>> > >> >> java -jar myapp.war); WAR files per-se are not directly executable.
>> > >> >>
>> > >> >>
>> > >> >> If you’re interested in such a solution, I can post more details
>> > here.
>> > >> >>
>> > >> >> Best regards,
>> > >> >> Thilo
>> > >> >>
>> > >> >>
>> > >> >>
>> > >> >>
>> > >> >>
>> > >> >>
>> > >> >> Am 28.07.15 11:09 schrieb "Dmitry Gusev" unter <
>> > dmitry.gu...@gmail.com <javascript:;>
>> > >> >:
>> > >> >>
>> > >> >> >Hello,
>> > >> >> >
>> > >> >> >Do you run tapestry apps in embedded container in production?
>> > >> >> >
>> > >> >> >If yes, how do you configure embedded container (ports, SSL,
>> valves,
>> > >> >> etc.)?
>> > >> >> >
>> > >> >> >Maybe there's some tapestry integration that configures tomcat
>> > instance
>> > >> >> >using tapestry-ioc and symbols?
>> > >> >> >
>> > >> >> >--
>> > >> >> >Dmitry Gusev
>> > >> >> >
>> > >> >> >AnjLab Team
>> > >> >> >http://anjlab.com
>> > >> >>
>> > >> >
>> > >> >
>> > >> >
>> > >> >--
>> > >> >Dmitry Gusev
>> > >> >
>> > >> >AnjLab Team
>> > >> >http://anjlab.com
>> > >>
>> > >
>> > >
>> > >
>> > >--
>> > >Dmitry Gusev
>> > >
>> > >AnjLab Team
>> > >http://anjlab.com
>> >
>>
>>
>>
>> --
>> Dmitry Gusev
>>
>> AnjLab Team
>> http://anjlab.com
>>

Reply via email to