logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Exposito Aguilera, Francisco" <francisco.expos...@es.issworld.com>
Subject Doubt about log4j configuration and OCI
Date Tue, 18 May 2010 12:14:04 GMT
Hello,

I have a doubt about how to configure log4j in order to avoid the error 

java.lang.UnsatisfiedLinkError: Native Library
C:\oracle\product\10.2.0\client_1\BIN\ocijdbc10.dll already loaded in
another classloader

I want log write the log in the same database as the other sql statements I
need for my application.


I have a DAO Connection class with this method:

public static Connection getConnection()
{
	InitialContext initContext = new InitialContext();
	Context envContext  = (Context)
initContext.lookup("java:/comp/env");
	DataSource dataSource = (DataSource)
envContext.lookup("jdbc/testdb");
	return dataSource.getConnection();
}

This method uses the DB info placed in META-INF/context.xml file:

<Resource name="jdbc/testdb" auth="Container"
		     type="javax.sql.DataSource" username="aaaa"
password="bbbb"
			  driverClassName="oracle.jdbc.driver.OracleDriver"
			  url="jdbc:oracle:oci:@DESARROLLO"
			  maxActive="20" maxIdle="24"/>


Then I have my log4j.xml files configured like that:

<appender name="db" class="org.apache.log4j.jdbc.JDBCAppender">           
	<param name="driver" value="oracle.jdbc.driver.OracleDriver"/>   
	<param name="URL" value="jdbc:oracle:oci:@DESARROLLO"/>
	<param name="user" value="aaaa"/>   
	<param name="password" value="bbbb"/>
	<param name="sql" value="INSERT INTO TABLE.LOG4JTEST
(Fecha,Clase,Prioridad,usuario,Mensaje)
	VALUES ( '%n%d{yyyy-MM-dd
HH:mm:ss}','%C-%M(%L)','%p',SUBSTR('%m',1,INSTR('%m',':')-1),SUBSTR('%m',INS
TR('%m',':')+2))"/>
	<param name="sql" value="INSERT INTO FEXPOSITO.LOG4JTEST
(Fecha,Clase,Prioridad,usuario,Mensaje)
	VALUES ( '%n%d{yyyy-MM-dd HH:mm:ss}','%C-%M(%L)','%p','%m','%m')"/>

</appender>


But when I execute the first log.debug statement (the connection class has
been already executed), I receive the error

java.lang.UnsatisfiedLinkError: Native Library
C:\oracle\product\10.2.0\client_1\BIN\ocijdbc10.dll already loaded in
another classloader

Any idea?

Thanks in advance.

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


Mime
View raw message