You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Ceki Gülcü <cg...@qos.ch> on 2001/04/11 18:45:49 UTC
Re: WG: Configuration issue with JDBCAppender
Has this been solved? Cheers, Ceki
At 00:34 27.03.2001 +0200, you wrote:
>Hello Todd,
>
>youre right, nullpointerexceptions shouldnt happen...
>
>First i take a look at your given configuration-file.
>Whats up with the type of column ObjectName ? Doesnt look well :
>
> # Columns-option to describe the important columns of the table
> # (Not nullable columns are mandatory to describe!)
> log4j.appender.JDBC.columns=LogTime~TIMESTAMP
> MessageId~ID~com.eaonet.utilities.MyIDHandler MessageText~MSG
> ObjectName~getClass().getName()
>
>All valid types and the syntax for column list is available @ documentaion.
>Please check this again ;)
>
>Now to the exceptions. The exception was definetly raised in
>JDBCAppender::connect().
>The class-cast shouldnt be the problem, because there wasnt a
>classcastexception...
> connectionHandler = (JDBCConnectionHandler)
>(Class.forName(connection_class).newInstance());
>So i suppose, that the new instantiated JDBCConnectionHandler isnt willing
>to give us a connection.
> if (url != null && username != null && password != null) {
> con = connectionHandler.getConnection(url, username,
>password);
> }
> else {
> con = connectionHandler.getConnection();
> }
>
>Because con returns as null, the following statement will fail and raise a
>nullpointerexception :
> if (con.isClosed()) {
>
>So, i think the problem is something with the DriverManager ...?
> con = DriverManager.getConnection(_url, _username, _password);
>
>Just try to get a connection in a separated HelloWorld-program.
>When the DriverManager dont returns a valid Connection there is something
>wrong i dont know...
>But when that one is working well, send me everything you have including
>description of driver and database (also table definition, etc...)
>and i will debug , ok ? But first ensure thats not any driver problem ... ;)
>
>
>Thanks for your report !
>
>:) Thomas
>
>-----Ursprüngliche Nachricht-----
>Von: tnist@FBOS.com [mailto:tnist@FBOS.com]
>Gesendet: Freitag, 23. März 2001 21:28
>An: t.fenner@klopotek.de
>Betreff: Configuration issue with JDBCAppender
>
>
>Mr. Fenner,
>
>I am attempting to use the JDBCAppender developed by yourself and am
>encountering the following problems when configuring it. When I leave the
>"log4j.appender.JDBC.connector" option comment out, and utilize the
>"DefaultConnectionHandler" in the JDBCAppender class I get the following
>error:
>
> log4j:ERROR JDBCAppender::configure(), java.lang.Exception:
>JDBCAppender::connect(), java.lang.NullPointerException
>
>When I create a class to implement the JDBCConnectionHandler interface and
>specify it in the connector option, I get the following error:
>
> log4j:ERROR JDBCAppender::configure(), java.lang.Exception:
>JDBCAppender::connect(), java.lang.ClassNotFoundException: Log4jJDBCHandler
>
>My environment is as follows:
>
> Tomcat: 3.2.1
> Apache: 1.3.14
> MySQL: 3.23
> OS: WIN 2K
> JDK: 1.3
>
>The log4j.properties file is as shown below:
>
> log4j.rootCategory=JDBC
>
>
> # Configure the JDBCAppender
> log4j.appender.JDBC=com.klopotek.utils.log.JDBCAppender
>
> # JDBC is a class of JDBCAppender, which writes messages into the
>database
> log4j.appender.JDBC.url=jdbc:mysql://localhost:3306/mydb
> log4j.appender.JDBC.username=test
> log4j.appender.JDBC.password=test
>
> # Connector-option to specify your own JDBCConnectionHandler
> #log4j.appender.JDBC.connector=MyConnectionHandler
>
> # Table-option to specify one table contained by the database for
>loging
> log4j.appender.JDBC.table=syslog
>
> # Columns-option to describe the important columns of the table
> # (Not nullable columns are mandatory to describe!)
> log4j.appender.JDBC.columns=LogTime~TIMESTAMP
>MessageId~ID~com.eaonet.utilities.MyIDHandler MessageText~MSG
>ObjectName~getClass().getName()
>
> # Define the layout of the messages (optional) for the database
> log4j.appender.JDBC.layout=org.apache.log4j.PatternLayout
> log4j.appender.JDBC.layout.ConversionPattern=%m
>
> # Buffer-opiton: define the size of the message-event-buffer
>(optional)
> #log4j.appender.JDBC.buffer=1
>
> # Commit-option: define a auto-commitment (optional)
> #log4j.appenderlJDBC.commit=Y
>
> # Print only messages of priority which is equal to or above the
>value specified below in the package com.eaonet.
> # Possible values: DEBUG, INFO, WARN, ERROR, FATAL
> log4j.category.com.myappo=INFO
>
>I have compiled the JDBCAppender along with the supporting classes and
>created a JAR file which I have placed in the TOMCAT_HOME/lib directory. It
>is finding the JDBCAppender class ok but is failing on the connector
>options.
>
>I am sure that I must have something configured incorrectly, or am not
>specifying something quite right. Any assistance would be appreciated.
>
>Regards,
>
>
>Todd G. Nist
>Email: tnist@fbos.com
>
>
>
>
>The information in this electronic mail ("e-mail") message may
>be confidential and for use of only the named recipient. The
>information may be protected by privilege, work product immunity
>or other applicable law. If you are not the intended recipient
>the retention, dissemination, distribution or copying of this
>e-mail message is strictly prohibited. If you receive this e-mail
>message in error please notify us immediately by telephone
>at 770-723-1011 or arudesea@fbos.com Thank you.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
--
Ceki Gülcü Web: http://qos.ch
email: cgu@qos.ch or ceki_gulcu@yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org