Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Grails Access Logging from run-app

Since calling run-app uses the tomcat-plugin in grails, how do I modify the grails AccessLogValve in the server.xml when it does not exists?

I only need this for development since in production I will just deploy the war to tomcat.

Thanks In Advance

like image 996
Aaron Saunders Avatar asked Jan 23 '10 04:01

Aaron Saunders


People also ask

How do I run grails in CMD?

Running a Grails Application Using run-app Go to the application directory. For example, go to the as-install /grails/samples/helloworld directory. Run the grails run-app command. The grails run-app command starts the Enterprise Server in the background and runs the application in one step.

What is groovy config?

groovy, is for settings that are used when running Grails commands, such as compile, doc, etc. The second file, Config. groovy, is for settings that are used when your application is running. This means that Config. groovy is packaged with your application, but BuildConfig.

How do I create a grails application?

Go to start.grails.org and use the Grails Application Forge to generate your Grails project. You can choose your project type (Application or Plugin), pick a version of Grails, and choose a Profile - then click "Generate Project" to download a ZIP file. No Grails installation necessary!

How do I cancel my grails application?

1.2 If you want to stop your server (and app), you can, at the grails prompt, enter 'stop-app', which will stop the server and app.


1 Answers

You can configure it in a callback for the 'ConfigureTomcat' event in scripts/_Events.groovy:

import org.apache.catalina.valves.AccessLogValve

eventConfigureTomcat = { tomcat ->
 tomcat.host.addValve new AccessLogValve(
  directory: basedir, prefix: 'localhost_access_log.', pattern: 'common')
}
like image 83
Burt Beckwith Avatar answered Sep 30 '22 08:09

Burt Beckwith