It’s relatively straightforward and New Relic’s docs show you how to do it just fine for Tomcat 6.
First, go look over New Relic’s documentation, I’m not going to repeat all the details they show there.
The only difference is the following:
At the Container JVM Command Line Options field, instead of the
-javaagent ... string New Relic recommends, put this in instead:
Where the path to newrelic.jar assumes that you've put your newrelic.jar library in the WAR's WEB-INF/lib directory.
Setting the Logging Environment Name
You can also set the logging environment name in the same line. After the
-javaagent ... string you justed enter, put in this:
If you read through the newrelic.yml file, you can see all the different options that switching environments can give to you besides just a different name in the New Relic dashboard.