Re: [netcdf-java] Fwd: New Ticket - [netCDFJava !AEU-822700]: Disabling netCDF warning messages

>
> If it is benign, I'd like to know the cleanest way to shut these warnings 
> off.  I develop in the maven/eclipse environment.
>  From the SLF documentation I reference I could see how to turn them off when 
> I run my tests from mvn by modifying
> $JAVA_HOME/jre/lib/logging.properties.  However, I'd prefer to accomplish 
> this in a more maintainable manner by modifying my mvn pom
> file.  I tried doing that by adding the following
>
>      <dependency>
>        <groupId>org.slf4j</groupId>
>        <artifactId>slf4j-log4j12</artifactId>
>        <version>1.5.11</version>
>        <scope>test</scope>
>      </dependency>
>
> But then I got the following messages when I ran the test:
>
> SLF4J: Class path contains multiple SLF4J bindings.
> SLF4J: Found binding in
> [jar:file:/home/schaffer/.m2/repository/org/slf4j/slf4j-log4j12/1.5.11/slf4j-log4j12-1.5.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: Found binding in
> [jar:file:/home/schaffer/.m2/repository/ucar/netcdfAll/4.0/netcdfAll-4.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an 
> explanation.
> log4j:WARN No appenders could be found for logger (ucar.nc2.NetcdfFile).
> log4j:WARN Please initialize the log4j system properly.
>
>
If you're using SLF4J/Log4j in Maven you can shut off those messages by
creating a log4j.properties or log4j.xml file and putting it in
src/test/resources. (or in src/main/resources if you want it applied to code
other than your unit tests) Here's an example of the contents that could go
into log4j.xml :

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

    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="conversionPattern" value="%d{ISO8601} [%t] %-5p %c
%x - %m%n" />
        </layout>
    </appender>

    <logger name="org.mbari.vcr">
        <level value="error" />
    </logger>

    <root>
<!-- Values can be "debug|info|warn|error" -->
        <priority value="error" />
        <appender-ref ref="CONSOLE" />
    </root>
</log4j:configuration>

-- 
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Brian Schlining
bschlining@xxxxxxxxx
  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: