It would be nice if NCR's Teradata JDBC driver 
complied with Ceki's advice:

{{

http://www.geocrawler.com/archives/3/8359/2002/7/50/9157442/

DATE: 07/27/2002 00:56:18
SUBJECT: RE:  Eleminate multiple intialization 

The following text, intended for library developers that use log4j, is
from the complete manual. Please make sure to send this to the owners
of the third-party libraries you are using:

Embedded Libraries using log4j

Configuring log4j is the responsibility of the end-user or generally
the application deployer. Whenever possible, a library should not try
to configure logging but leave it to the deployer. After all, logging
output is useful only if someone will take the time to look at
them. If the end-user wishes to log then she should control the
logging configuration. Nevertheless, it is helpful for the library
developer to provide documentation on logging, preferably with
complete and working examples. The names of the loggers that the
library uses are prime candidates to include in such documentation.

[...]

}}

> -----Original Message-----
> From: Sullivan, Sean C - MWT
> Subject: "Category root set to OFF", Log4j, Teradata JDBC type 4 driver
> 
> 
> This is my workaround.
> 
> I call this method after the Teradata JDBC driver is loaded.
> 
> static void resetLoggingConfiguration()
> {
> 
> try
> {
>  LogManager.resetConfiguration();
>  String strConfig = System.getProperty("log4j.configuration");
>  URL configFile = new java.net.URL(strConfig);
>  DOMConfigurator.configure(configFile);
>  Logger rootLogger = LogManager.getRootLogger();
>  rootLogger.setLevel(Level.ALL);
> }
> catch (Exception ex)
> {
>  ex.printStackTrace();
> }
> finally
> {
>  log.info("resetLoggingConfiguration() called");
> }
> 
> 
> -Sean
> 
> 
> > -----Original Message-----
> > From: Sullivan, Sean C - MWT
> >
> >
> > My application uses the NCR Teradata JDBC driver.
> >
> > terajdbc4.jar  - version 3.0.0.1
> >
> > http://www.teradata.com/
> >
> > By default, this driver will shut off Log4j's root logger.
> >
> > I don't know why NCR decided to implement the driver in this
> > manner.
> >
> > I found a PDF on www.teradata.com: Teradata-JDBC-2012-033C.pdf
> >
> > The PDF explains how Teradata's JDBC driver uses Log4j.
> >
> > I am planning to contact Teradata tech support.
> >
> > -Sean
> >
> >
> >
> > > -----Original Message-----
> > > From: Sullivan, Sean C - MWT
> > >
> > > Here is my configuration:
> > >
> > >   Jakarta Commons Logging 1.0.3
> > >   Log4j 1.2.8
> > >   IBM Websphere Application Server 4.0.5
> > >
> > > My stdout log file shows this output:
> > >
> > > log4j: Parsing for [root] with value=[OFF].
> > > log4j: Level token is [OFF].
> > > log4j: Category root set to OFF
> > > log4j: Finished configuring.
> > >
> > > What does "Category root set to OFF" mean?
> > >
> > >
> > > Here is my config file, log4j.xml
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
> > >
> > > <!--
> > =====================================================================
> > > -->
> > > <!--
> > > -->
> > > <!--  Log4j configuration file
> > > -->
> > > <!--
> > > -->
> > > <!--
> > =====================================================================
> > > -->
> > >
> > >
> > >
> > > <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/";
> > > debug="true" >
> > >
> > >   <appender name="STDERR" class="org.apache.log4j.ConsoleAppender">
> > >             <param name="Target" value="System.err"/>
> > >             <layout class="org.apache.log4j.PatternLayout">
> > >                <param name="ConversionPattern"
> > >                  value="%-5p %c{3} - %m [%X{server.hostname}]%n"/>
> > >             </layout>
> > >
> > >             <filter class="org.apache.log4j.varia.LevelRangeFilter">
> > >                 <param name="AcceptOnMatch" value="true"/>
> > >                 <param name="LevelMin" value="WARN"/>
> > >                 <param name="LevelMax" value="FATAL"/>
> > >             </filter>
> > >
> > >   </appender>
> > >
> > >   <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
> > >             <param name="Target" value="System.out"/>
> > >             <layout class="org.apache.log4j.PatternLayout">
> > >                <param name="ConversionPattern"
> > >                  value="%-5p %c{3} - %m [%X{server.hostname}]%n"/>
> > >             </layout>
> > >             <filter class="org.apache.log4j.varia.LevelRangeFilter">
> > >                 <param name="AcceptOnMatch" value="true"/>
> > >                 <param name="LevelMin" value="INFO"/>
> > >                 <param name="LevelMax" value="INFO"/>
> > >             </filter>
> > >   </appender>
> > >
> > >   <appender name="EMAILNOTIFICATION"
> > > class="org.apache.log4j.net.SMTPAppender">
> > >           <param name="SMTPHost" value="somehost.foobar.net"/>
> > >                 <param name="To" value="[EMAIL PROTECTED]"/>
> > >           <param name="From" value="[EMAIL PROTECTED]"/>
> > >           <param name="Subject" value="Message from Websphere"/>
> > >                 <param name="BufferSize" value="1"/>
> > >                 <layout class="org.apache.log4j.PatternLayout">
> > >                      <param name="ConversionPattern"
> > >                        value="[%d{DATE}]%nServer hostname:
> > > %X{server.hostname}%n%-5p %c{3} - %m%nThread name: %t%n"/>
> > >                 </layout>
> > >   </appender>
> > >
> > >   <!-- ======================= -->
> > >   <!-- Setup the Root category -->
> > >   <!-- ======================= -->
> > >
> > >   <root>
> > >    <priority value ="all" />
> > >    <appender-ref ref="STDOUT" />
> > >    <appender-ref ref="STDERR" />
> > >    <appender-ref ref="EMAILNOTIFICATION" />
> > >   </root>
> > >
> > > </log4j:configuration>
> > >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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

Reply via email to