Hi Daniel-

You can use the same parameters in an XML config file as you do for a text
config file.  Here is a sample of an XML config file that has a JDBCAppender
and a RollingFileAppender (using the RollingFileAppenderExt):

** Also, look in the ../docs/api/org/apache/log4j/xml/examples/doc-files
directory at the sample XML config files.

Hope this helps!




-----Original Message-----
From: Daniel Weingaertner [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 22, 2002 9:19 PM
To: [EMAIL PROTECTED]
Subject: XML configuration parameters!



        Hi folks,

  I'm just starting to use log4j and I didn't find any documentation
about the parameters I can set on an XML configuration file for
Appenders, for example. Is there any "API" of the valid parameters for
those objects?

        Thanks,
        Daniel
-- 
Daniel Weingaertner                             [EMAIL PROTECTED]
Computer Eng. Msc. Student   http://www.dca.fee.unicamp.br/~danielw
DCA - FEEC - Unicamp                          Campinas, SP - Brasil

22-I-2002

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

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

<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>

        <!-- 
        The JDBC Appender logs to a database given a valid JDBC URL, 
        database username (if applicable), database password (if applicable),
        database driver, and SQL statement (this can also be a stored
        procedure).

        The logging message, class, priority, and logdate are to be logged to 
        a database table. The SQL statement must insert these values: 
        ('%m', '(%c)', '%p', '%d{ISO8601}') .

        The 'Threshold' attribute is set to WARN to only log to the database
        messages with a logging priority level of WARN or higher.
        -->
        <appender name="jdbc" class="org.apache.log4j.varia.JDBCAppender">
                <param name="URL" value="jdbc:odbc:someODBC"/>
                <param name="user" value=""/>
                <param name="password" value=""/>
                <param name="driver" value="sun.jdbc.odbc.JdbcOdbcDriver"/>
                <param name="sql" value="insert into JDBCAppenderTest (message, class, 
priority, logdate) values ('%m', '(%c)', '%p', '%d{ISO8601}')"/>
                <param name="threshold" value="WARN"/>
        </appender>


        <!--
        The Daily Rolling File Appender rolls over at midnight daily.  All logging
        messages are logged to this file.  A new file is created in the format 
        'someName.yyyy-mm-dd.log'.  A maximum of 30 log files are kept.  When that 
        number is exceeded, the oldest file is deleted to make room for the newest 
file.
        -->
        <appender name="dailyRollFile" 
class="org.apache.log4j.DailyRollingFileAppenderExt">
                <param name="DatePattern" value="'.'yyyy-MM-dd"/>
                <param name="MaxLogs" value="30"/>
                <param name="File" value="logs/fms.log"/>
                        <layout class="org.apache.log4j.PatternLayout">
                                <param name="ConversionPattern" value="%-15d{ABSOLUTE} 
%-10p (%c) - %m%n"/>
                        </layout>       

        </appender>

        
        <root>
                <priority value="debug"/>
                <appender-ref ref="jdbc"/>
                <appender-ref ref="dailyRollFile"/>
        </root>
</log4j:configuration>
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to