logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alasdair Richardson" <alasdair.richard...@jabcap.com>
Subject RE: Configure the debug value to true or false when needed through C# code
Date Tue, 19 Jan 2010 07:50:07 GMT
well if you are changing the config file (I thought you wanted to change
via code) surely you just change the level?
 
<root>
  <level value="DEBUG" />
  <appender-ref ref="RollingLogFileAppender" />
 </root>
 
change DEBUG to INFO or WARN or ERROR ?? or am I misunderstanding again?


________________________________

	From: Leo Mathew [mailto:leo.m@sonata-software.com] 
	Sent: 19 January 2010 08:45
	To: Alasdair Richardson
	Cc: Log4NET User
	Subject: RE: Configure the debug value to true or false when
needed through C# code
	
	

	Hi Alasdair,

	 

	I have attached the config file along with this mail.

	 

	Though I had manually changed the debug to "false", the log file
still showed the log messages. Could you let me know if this is the
right way to stop logging?

	 

	Regards,

	Leo

	 

	
________________________________


	From: Alasdair Richardson
[mailto:alasdair.richardson@jabcap.com] 
	Sent: Tuesday, January 19, 2010 12:58 PM
	To: Log4NET User; Leo Mathew
	Subject: RE: Configure the debug value to true or false when
needed through C# code

	 

	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:leo.m@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.

	 

____________________________________
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.

Mime
View raw message