logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <...@qos.ch>
Subject Re: FW: JDBCAppender...
Date Tue, 05 Jun 2001 15:38:57 GMT

Hi,

Run your application with the log4j.debug flag. As in

java -Dlog4j.debug LogThisTester

See comments below.

At 11:09 05.06.2001 -0400, you wrote:
>I have the following error when running the sample code below:
>
>log4j:ERROR No appenders could be found for category
>(com.mellon.te.logging.test.LogThisTester).
>log4j:ERROR Please initialize the log4j system properly.
>
>Any help with getting a sample JDBCAppender class writing messages to a DB
>would be greatly appreciated.
>
>Tommy
>
>-----Original Message-----
>From: Emricko Thomas E [mailto:emricko.te@mellon.com]
>Sent: Monday, June 04, 2001 5:22 PM
>To: 'log4j-user@jakarta.apache.org'
>Subject: JDBCAppender...
>
>
>Hello -
>
>I am looking for some help with getting the JDBCAppender to work with log4j.
>
>My goal is to have one class to be a 'proof of concept' that I can write a
>simple log message to a database (DB2), here is my class:
>
>public class LogThisTester{
>        
>        static Category MyCat =
>Category.getInstance(LogThisTester.class.getName());
>
>        public static void main(String[] args) {
>
>        // Ensure to have all necessary drivers installed !
>        try
>        {
>           Driver d =
>(Driver)(Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance());
>           DriverManager.registerDriver(d);
>           System.out.println("DB2 JDBC Database Driver loaded.");
>        }
>        catch(Exception e){
>                System.out.println("DB2 JDBC Database Driver can't be
>found.");
>                e.printStackTrace();
>        }               


Remove following two lines:

>        
>        // Set the priority which messages have to be logged
>        MyCat.setPriority(Priority.INFO);
>
>        // Configuration with configuration-file
>        String theFile =
>ConfigurationManager.getServiceConfigFilePath("EB0LoggingServices");
>        PropertyConfigurator.configure(theFile);
>
>        MyCat.debug( "Debug" );
>        }
>}
>
>and my property file:
>
># Declare a appender variable named JDBC
>log4j.rootCategory=JDBC

Wrong syntax. Try
logg4j.rootCategory=DEBUG,JDBC


># JDBC is a class of JDBCAppender, which writes messages into a database
>log4j.appender.JDBC=com.klopotek.utils.log.JDBCAppender
>
># 1. Database-options to connect to the database
>log4j.appender.JDBC.url=jdbc:db2:foo
>log4j.appender.JDBC.username=db2admin
>log4j.appender.JDBC.password=password
>
># 2. Connector-option to specify your own JDBCConnectionHandler
>#log4j.appender.JDBC.connector=MyConnectionHandler

[removed]

Regards, Ceki 



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