Classification: Public Hi Ralph, Thanks for getting back, but the examples do not show how to change levels at runtime,
There is no method addLogger(String, LoggerConfig) method on the Configuration interface. The addLogger method exists on BaseConfiguration, however it throws an IllegalStateException as its already started, and says you have to create a new configuration. Is it actually possible to change the logging level for a class/package at runtime after startup? I think this is a common use case for troubleshooting critical long running processes. thanks, Phil From: Ralph Goers <[email protected]> To: Log4J Users List <[email protected]>, Date: 23/06/2014 15:57 Subject: Re: how to change logging level for a class at runtime Please see http://people.apache.org/~rgoers/log4j2/manual/customconfig.html Ralph On Jun 23, 2014, at 3:44 AM, Phil Wray <[email protected]> wrote: > Classification: Public > > Hi, > Would like to turn on debug for a particular class or package at runtime, > either via jmx or programmatically, where this class or package is > arbitrary and not known at start up time please. > I can't see a way to do this? > Previous posts titled "Programmatic configuration of loggers" show how to > do this for an existing named logger but not for an arbitrary class or > package which is a typical use case. > LoggerConfig loggerConfig = config.getLoggerConfig(loggerName); > > But this returns the root logger if no existing logger for that name > exists - and we can't just enable debug on everything. > Is there a way of adding a new LoggerConfig into the configuration? > > thanks, > Phil Wray > > > > > --- > > This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. > > Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures and to http://www.db.com/unitedkingdom/content/privacy.htm for information about privacy. --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures and to http://www.db.com/unitedkingdom/content/privacy.htm for information about privacy.
