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 RE: Doubt about log4j configuration and OCI
Date Thu, 20 May 2010 06:12:41 GMT
Thanks... I also have found that if I put the database jar
ojdbc14-10.2.0.1.0.jar in tomcat lib folder, it workd properly!!

-----Mensaje original-----
De: Douglas E Wegscheid [mailto:Douglas_E_Wegscheid@whirlpool.com] 
Enviado el: martes, 18 de mayo de 2010 14:39
Para: Log4J Users List
CC: 'log4j-user@logging.apache.org'
Asunto: Re: Doubt about log4j configuration and OCI

ahha. someone *has* done a JDBCAppender that will use an existing 
datasource. Take a look at 
http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/

Douglas E Wegscheid
Lead Technical Analyst, Whirlpool Corporation

"A wrong note played hesitatingly is a wrong note. A wrong note played 
with conviction is interpretation."



"Exposito Aguilera, Francisco" <francisco.exposito@es.issworld.com> wrote 
on 05/18/2010 08:14:04 AM:

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

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