logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abhijat Thakur" <abhijat.tha...@bdnacorp.com>
Subject RE: Logging at Run Time
Date Tue, 11 Sep 2001 01:54:16 GMT
Hi,

This XML file tells about different appenders and then associates Category
to the appenders and priority. So when the system starts up we can give this
xml file (i use a properties file) to PropertyConfigurator and it sets the
Category and assciated Priorities and Appenders. Lets say at run time i want
to disable priority debug associated with occproject. How can i do that if
it is possible.

Thanks a lot.



Abhijat



-----Original Message-----
From: Gunter Sammet [mailto:Gunter@sammet.net]
Sent: Monday, September 10, 2001 6:43 PM
To: 'LOG4J Users Mailing List'; abhijat.thakur@bdnacorp.com
Subject: RE: Logging at Run Time


You have five priorities. Debug, info, warn, error and fatal. You can use
them e.g. cat.debug("This is a debug message"), cat. info("Just wanted to
let you know that it works"), cat.warn("Be careful, otherwise I might create
some problems"), etc..

I'm not sure if you want to change the configuration while the program is
running. Haven't done that and I'm not sure if it works. But you can
enable/disable through XML or properties file. I use XML, and that's one
sample how it could look like:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration debug="false">

        <appender name="A1" class="org.apache.log4j.DatedFileAppender">
		<param name="File" value="C:/occ/logs/occ.log"/>
                <param name="Append" value="true" />
		<layout class="org.apache.log4j.PatternLayout">
  		     <param name="ConversionPattern"
                            value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
		</layout>
	</appender>

        <appender name="A2" class="org.apache.log4j.ConsoleAppender">
		<layout class="org.apache.log4j.PatternLayout">
  		     <param name="ConversionPattern"
                            value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
		</layout>
	</appender>

	<appender name="LF5Appender" class="com.servidium.lf5.LF5Appender">
		<param name="MaxNumberOfRecords" value="1000" />

	</appender>

	<!--This is a package-->
	<category name="org.apache.log4j.xml">
	  <priority value="info" />
  	   <appender-ref ref="A1" />
   	   <appender-ref ref="A2" />
	</category>

	<!--This is a package-->
	<category name="occproject">
	  <priority value="debug" />
  	   <appender-ref ref="A1" />
   	   <appender-ref ref="A2" />
	</category>

	<root>
	   <priority value ="info" />
   	   <appender-ref ref="A1" />
   	   <appender-ref ref="A2" />
           <appender-ref ref="LF5Appender" />
	</root>

</log4j:configuration>

Hope this helps!

Gunter

PS: DatedFileAppender is an addition and I'm not sure if it is already in
your package. LF5Appender is a class from a graphical tool.

-----Original Message-----
From: log4j-user-return-2974-Gunter=sammet.net@jakarta.apache.org
[mailto:log4j-user-return-2974-Gunter=sammet.net@jakarta.apache.org]On
Behalf Of Abhijat Thakur
Sent: Monday, September 10, 2001 7:15 PM
To: log4j-user@jakarta.apache.org
Subject: Logging at Run Time


Hi,

I had a few doubts

*Can a Category have more than one Priority.
*If a priority for a category is enabled how can it be disabled at run time.

Thanks a lot

Abhijat Thakur

bDNA Corporation


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message