I tried to set the log level throuh an environment variable but it turned out not to work (works ok for the file name). So I set the level in code from the environment variable as follows - not sure if this is what you want? it sets the root logging level .. private void FixLogLevel() { // as the log level does not seem to be successfully set from the env var string level = GetEnv("JCE_LOG_LEVEL"); ILoggerRepository repository = LogManager.GetRepository(); Logger logger = repository.GetLogger("root") as Logger; while (!(logger is RootLogger)) logger = logger.Parent; logger.Level = repository.LevelMap[level]; }
________________________________ From: Leo Mathew [mailto:le...@sonata-software.com] Sent: 19 January 2010 06:46 To: log4net-user@logging.apache.org Subject: Configure the debug value to true or false when needed through C# code Hi All, We are using log4Net in our application. We want to make the debugging of statements to be enabled or disabled. Is it possible to configure this by setting the below debug value to "true" or "false" through the C# code? <log4net debug="false"> The above line is from log4Net.config file. Regards, Leo ____________________________________ The information contained in this transmission is intended only for the person or entity to which it is addressed and 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 unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.