1

I want to dynamically switch between info/debug logs in production for my application running on a tomcat instance.

I am observing too many logs flooding our log files, so we ship with info, but if needed switch to debug for debugging. How should I do that in a dynamic fashion?

Rpj
  • 5,348
  • 16
  • 62
  • 122

2 Answers2

2

You could do this through JMX. If you are using log4j here is one option to expose a jmx mbean for log4j. Log4j2 provides JMX support out of the box.

Andy Dufresne
  • 6,022
  • 7
  • 63
  • 113
  • Is there a command line option, since i will have to monitor this on a remote Linux EC2 machine. – Rpj Dec 08 '14 at 12:20
  • 1
    JConsole - a jmx client can be used to see/monitor the current log level. Through jmx & jconsole you can monitor and change log levels of remotely running java applications. – Andy Dufresne Dec 08 '14 at 12:24
1

I am not sure there is an easy way to change logging levels ar runtime.
Logging levels are configured in tomcat_home/conf/logging.properties.
Supported levels are:

SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST or ALL

May be check this out Reload tomcat logging at runtime?

Community
  • 1
  • 1
outdev
  • 5,249
  • 3
  • 21
  • 38