1414/** Static methods to load the netcdf C library. */
1515public class NetcdfClibrary {
1616 private static org .slf4j .Logger log = org .slf4j .LoggerFactory .getLogger (NetcdfClibrary .class );
17- private static org .slf4j .Logger startupLog = org .slf4j .LoggerFactory .getLogger ("serverStartup" );
1817
1918 private static final String JNA_PATH = "jna.library.path" ;
2019 private static final String JNA_PATH_ENV = "JNA_PATH" ; // environment var
@@ -107,7 +106,7 @@ public static synchronized int setLogLevel(int level) {
107106 if (nc4 != null ) {
108107 try {
109108 oldlevel = nc4 .nc_set_log_level (log_level );
110- startupLog .info (String .format ("NetcdfLoader: set log level: old=%d new=%d" , oldlevel , log_level ));
109+ log .info (String .format ("NetcdfLoader: set log level: old=%d new=%d" , oldlevel , log_level ));
111110 } catch (UnsatisfiedLinkError e ) {
112111 // ignore
113112 }
@@ -127,13 +126,14 @@ private static Nc4prototypes load() {
127126 // Make the library synchronized
128127 // nc4 = (Nc4prototypes) Native.synchronizedLibrary(nc4);
129128 nc4 = new Nc4wrapper (nc4 );
130- startupLog .info ("Nc4Iosp: NetCDF-4 C library loaded (jna_path='{}', libname='{}' version='{}')." , jnaPath ,
131- libName , getVersion ());
132- startupLog .debug ("Netcdf nc_inq_libvers='{}' isProtected={}" , nc4 .nc_inq_libvers (), Native .isProtected ());
129+ log .info ("Nc4Iosp: NetCDF-4 C library loaded (jna_path='{}', libname='{}' version='{}')." , jnaPath , libName ,
130+ getVersion ());
131+ log .debug ("Netcdf nc_inq_libvers='{}' isProtected={}" , nc4 .nc_inq_libvers (), Native .isProtected ());
133132 } catch (Throwable t ) {
134133 String message =
135134 String .format ("Nc4Iosp: NetCDF-4 C library not present (jna_path='%s', libname='%s')." , jnaPath , libName );
136- startupLog .warn (message , t );
135+ log .warn (message );
136+ log .debug ("details: " , t );
137137 }
138138 String slevel = Strings .emptyToNull (System .getProperty (JNA_LOG_LEVEL ));
139139 if (slevel != null ) {
@@ -144,13 +144,11 @@ private static Nc4prototypes load() {
144144 }
145145 }
146146 try {
147- int oldlevel = setLogLevel (log_level );
148- startupLog .info (String .format ("Nc4Iosp: set log level: old=%d new=%d" , oldlevel , log_level ));
147+ setLogLevel (log_level );
149148 } catch (Throwable t ) {
150149 String message = String .format ("Nc4Iosp: could not set log level (level=%d jna_path='%s', libname='%s')." ,
151150 log_level , jnaPath , libName );
152- startupLog .warn ("Nc4Iosp: " + t .getMessage ());
153- startupLog .warn (message );
151+ log .debug ("Nc4Iosp: " + t .getMessage ());
154152 }
155153 }
156154 return nc4 ;
0 commit comments