Re: [netcdf-java] controlling logging

Thanks, John.  Is the JDK logging example in your docs still valid as well?

Don

On 2/4/14 2:09 PM, John Caron wrote:
Hi Don:

For 4.3 do the following:

1) you need to have these jars in your application's classpath:

   slf4j-log4j12-1.7.5.jar
   log4j-1.2.17.jar

2) now you need a log4j.xml file, also in your classpath, heres a minimal one:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>

   <appender name="applog" class="org.apache.log4j.RollingFileAppender">
     <param name="File" value="mylog/app.log"/>
     <param name="MaxFileSize" value="10MB"/>
     <param name="MaxBackupIndex" value="10"/>
   </appender>

   <root>
     <level value="WARN"/>
     <appender-ref ref="applog"/>
   </root>

</log4j:configuration>

this would suppress all messages except WARN and ERROR and log those to

   "mylog/app.log"

keeping up to 10 10MB logs. So make your changes as needed.

In 4.4 we have switched to log4j2, so the config file is a bit different.
Ill try to update the web pages.

John


On 2/4/2014 10:47 AM, Don Murray (NOAA Affiliate) wrote:
Hi-

What's the best way to control the logging programatically through log4j
in netCDF-Java 4.3?  I have a couple of applications (IDV and RAMADDA)
that use the library and the number of INFO messages has exanded
considerably in version 4.3.   What's the best way to set the logging
level or turn if off?  I tried following the suggestions on this page:

http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/reference/JarDependencies.html


but was unsuccessful.  If someone has a working example, I'd apprecitate
the help.

Thanks.

Don

_______________________________________________
netcdf-java mailing list
netcdf-java@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit: 
http://www.unidata.ucar.edu/mailing_lists/


--
Don Murray
NOAA/ESRL/PSD and CIRES
303-497-3596
http://www.esrl.noaa.gov/psd/people/don.murray/



  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: