Use the method PropertyConfigurator.configureAndWatch(filename,
intervalInMilliseconds); 

The config file will be checked every intervalInMilliseconds... if its time
stamp is updated it
will be re-read and the new configuration put into action.

--Stephen

-----Original Message-----
From: Abhijat Thakur [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 9:54 PM
To: LOG4J Users Mailing List; [EMAIL PROTECTED]
Subject: RE: Logging at Run Time


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:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 6:43 PM
To: 'LOG4J Users Mailing List'; [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On
Behalf Of Abhijat Thakur
Sent: Monday, September 10, 2001 7:15 PM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to