How to I enable DEBUG logging for a Grails app in Tomcat?

View: New views
5 Messages — Rating Filter:   Alert me  

How to I enable DEBUG logging for a Grails app in Tomcat?

by Robert La Ferla-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How to I enable DEBUG logging for a Grails app in Tomcat?  I don't want
to have to recompile to change the log level settings.  I want to
control debug logging externally (like a log4j config file) as this is
for a production system.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: How to I enable DEBUG logging for a Grails app in Tomcat?

by Benjamin Muschko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think your best bet is to use JMX. Making your logger manageable let's you change the log level for certain packages at runtime without having to restart the container. To make this work write a class and make it manageable using Spring annotations or the MBeanExporter. You got to start your Tomcat JVM with the required JMX startup parameters.

As far as I know the JMX Plugin already does all the work for you: http://www.grails.org/JMX+Plugin.

Re: How to I enable DEBUG logging for a Grails app in Tomcat?

by Robert La Ferla-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Benjamin Muschko wrote:
> I think your best bet is to use JMX. Making your logger manageable let's you
> change the log level for certain packages at runtime without having to
> restart the container. To make this work write a class and make it
> manageable using Spring annotations or the MBeanExporter. You got to start
> your Tomcat JVM with the required JMX startup parameters.
>
> As far as I know the JMX Plugin already does all the work for you:
> http://www.grails.org/JMX+Plugin.
>  
Is there a simpler way of doing this without JMX?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: How to I enable DEBUG logging for a Grails app in Tomcat?

by Anatoliy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Robert La Ferla-6 wrote:
Benjamin Muschko wrote:
> I think your best bet is to use JMX. Making your logger manageable let's you
> change the log level for certain packages at runtime without having to
> restart the container. To make this work write a class and make it
> manageable using Spring annotations or the MBeanExporter. You got to start
> your Tomcat JVM with the required JMX startup parameters.
>
> As far as I know the JMX Plugin already does all the work for you:
> http://www.grails.org/JMX+Plugin.
>  
Is there a simpler way of doing this without JMX?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

You have to create log4j.properties and put it in <path to your web-applications>/WEB-INF/classes/log4j.properties
For example (I use it for debuging purpose):
----------
log4j.rootLogger = ERROR

log4j.appender.debug = org.apache.log4j.FileAppender
log4j.appender.debug.file = ${catalina.home}/logs/debug.log
log4j.appender.debug.layout = org.apache.log4j.PatternLayout
log4j.appender.debug.layout.ConversionPattern = %d{ISO8601} [%t] %5p %c{2}:%M - %m%n

log4j.logger.grails.app.task = DEBUG, debug
log4j.logger.grails.app.service = DEBUG, debug
----------

Re: How to I enable DEBUG logging for a Grails app in Tomcat?

by madruga0315 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Robert La Ferla-6 wrote:
Is there a simpler way of doing this without JMX?
there is a plugin called "runtime-logging", did you looked at?

Regards
Madruga, Gustavo