Selaa lähdekoodia

Fix issue 1680 (inefficient use of loggers) (#1682)

* #1680 jme3-core inefficient use of loggers

* #1680 All modules : Gate FINE loggers when required for perf reasons

* #1680 All modules : Gate INFO loggers when required for perf reasons

* #1680 All modules : Gate INFO loggers when required for perf reasons

* #1680 Reverts the "not worthwhile" changes

* revert changes that added complexity to init/cleanup code

* whitespace

Co-authored-by: Cédric de Launois <>
Co-authored-by: Stephen Gold <[email protected]>
Cédric de Launois 3 vuotta sitten
vanhempi
commit
cec4131b12
38 muutettua tiedostoa jossa 313 lisäystä ja 150 poistoa
  1. 8 4
      jme3-android/src/main/java/com/jme3/app/AndroidHarnessFragment.java
  2. 6 4
      jme3-android/src/main/java/com/jme3/app/state/MjpegFileWriter.java
  3. 1 1
      jme3-android/src/main/java/com/jme3/app/state/VideoRecorderAppState.java
  4. 3 1
      jme3-android/src/main/java/com/jme3/input/android/AndroidJoyInput.java
  5. 17 8
      jme3-android/src/main/java/com/jme3/input/android/AndroidJoystickJoyInput14.java
  6. 27 15
      jme3-android/src/main/java/com/jme3/input/android/AndroidSensorJoyInput.java
  7. 4 2
      jme3-android/src/main/java/com/jme3/input/android/AndroidTouchInput.java
  8. 17 9
      jme3-android/src/main/java/com/jme3/system/android/AndroidConfigChooser.java
  9. 6 4
      jme3-android/src/main/java/com/jme3/system/android/JmeAndroidSystem.java
  10. 7 3
      jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java
  11. 4 2
      jme3-bullet/src/common/java/com/jme3/bullet/animation/PhysicsLink.java
  12. 6 2
      jme3-bullet/src/common/java/com/jme3/bullet/control/BetterCharacterControl.java
  13. 4 2
      jme3-bullet/src/common/java/com/jme3/bullet/control/ragdoll/RagdollPreset.java
  14. 6 2
      jme3-core/src/main/java/com/jme3/anim/MorphControl.java
  15. 3 1
      jme3-core/src/main/java/com/jme3/app/LegacyApplication.java
  16. 4 1
      jme3-core/src/main/java/com/jme3/app/state/ScreenshotAppState.java
  17. 16 9
      jme3-core/src/main/java/com/jme3/cinematic/events/AnimEvent.java
  18. 61 22
      jme3-core/src/main/java/com/jme3/input/JoystickCompatibilityMappings.java
  19. 10 6
      jme3-core/src/main/java/com/jme3/material/Material.java
  20. 3 1
      jme3-core/src/main/java/com/jme3/renderer/Camera.java
  21. 5 2
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
  22. 3 1
      jme3-core/src/main/java/com/jme3/scene/BatchNode.java
  23. 4 2
      jme3-core/src/main/java/com/jme3/scene/Geometry.java
  24. 3 1
      jme3-core/src/main/java/com/jme3/system/JmeSystemDelegate.java
  25. 3 1
      jme3-core/src/main/java/com/jme3/system/NullContext.java
  26. 1 3
      jme3-core/src/main/java/com/jme3/util/NativeObjectManager.java
  27. 9 4
      jme3-core/src/tools/java/jme3tools/optimize/GeometryBatchFactory.java
  28. 6 2
      jme3-core/src/tools/java/jme3tools/optimize/LodGenerator.java
  29. 11 7
      jme3-desktop/src/main/java/com/jme3/system/NativeLibraryLoader.java
  30. 6 2
      jme3-effects/src/main/java/com/jme3/post/filters/TranslucentBucketFilter.java
  31. 7 3
      jme3-examples/src/main/java/jme3test/light/pbr/ConsoleProgressReporter.java
  32. 9 6
      jme3-ios/src/main/java/com/jme3/input/ios/IosInputHandler.java
  33. 4 2
      jme3-ios/src/main/java/com/jme3/input/ios/IosTouchHandler.java
  34. 15 9
      jme3-lwjgl/src/main/java/com/jme3/input/lwjgl/JInputJoyInput.java
  35. 4 2
      jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java
  36. 3 1
      jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglOffscreenBuffer.java
  37. 4 2
      jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java
  38. 3 1
      jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/FbxLoader.java

+ 8 - 4
jme3-android/src/main/java/com/jme3/app/AndroidHarnessFragment.java

@@ -673,8 +673,10 @@ public class AndroidHarnessFragment extends Fragment implements
                 int newHeight = bottom-top;
 
                 if (viewWidth != newWidth || viewHeight != newHeight) {
-                    logger.log(Level.FINE, "SurfaceView layout changed: old width: {0}, old height: {1}, new width: {2}, new height: {3}",
-                            new Object[]{viewWidth, viewHeight, newWidth, newHeight});
+                    if (logger.isLoggable(Level.FINE)) {
+                        logger.log(Level.FINE, "SurfaceView layout changed: old width: {0}, old height: {1}, new width: {2}, new height: {3}",
+                                new Object[]{viewWidth, viewHeight, newWidth, newHeight});
+                    }
                     viewWidth = newWidth;
                     viewHeight = newHeight;
 
@@ -694,8 +696,10 @@ public class AndroidHarnessFragment extends Fragment implements
                     }
                     // set the surfaceview resolution if the size != current view size
                     if (fixedSizeWidth != viewWidth || fixedSizeHeight != viewHeight) {
-                        logger.log(Level.FINE, "setting surfaceview resolution to width: {0}, height: {1}",
-                                new Object[]{fixedSizeWidth, fixedSizeHeight});
+                        if (logger.isLoggable(Level.FINE)) {
+                            logger.log(Level.FINE, "setting surfaceview resolution to width: {0}, height: {1}",
+                                    new Object[]{fixedSizeWidth, fixedSizeHeight});
+                        }
                         view.getHolder().setFixedSize(fixedSizeWidth, fixedSizeHeight);
                     }
                 }

+ 6 - 4
jme3-android/src/main/java/com/jme3/app/state/MjpegFileWriter.java

@@ -126,10 +126,12 @@ public class MjpegFileWriter {
         int fileSize = (int)aviFile.length();
         logger.log(Level.INFO, "fileSize: {0}", fileSize);
         int listSize = (int) (fileSize - 8 - aviMovieOffset - indexlistBytes.length);
-        logger.log(Level.INFO, "listSize: {0}", listSize);
-        logger.log(Level.INFO, "aviFile canWrite: {0}", aviFile.canWrite());
-        logger.log(Level.INFO, "aviFile AbsolutePath: {0}", aviFile.getAbsolutePath());
-        logger.log(Level.INFO, "aviFile numFrames: {0}", numFrames);
+        if (logger.isLoggable(Level.INFO)) {
+            logger.log(Level.INFO, "listSize: {0}", listSize);
+            logger.log(Level.INFO, "aviFile canWrite: {0}", aviFile.canWrite());
+            logger.log(Level.INFO, "aviFile AbsolutePath: {0}", aviFile.getAbsolutePath());
+            logger.log(Level.INFO, "aviFile numFrames: {0}", numFrames);
+        }
 
         RandomAccessFile raf = new RandomAccessFile(aviFile, "rw");
 

+ 1 - 1
jme3-android/src/main/java/com/jme3/app/state/VideoRecorderAppState.java

@@ -375,7 +375,7 @@ public class VideoRecorderAppState extends AbstractAppState {
                     Thread.sleep(difference);
                 } catch (InterruptedException ex) {
                 }
-            } else {
+            } else if (logger.isLoggable(Level.INFO)) {
                 logger.log(Level.INFO, "actual tpf(ms): {0}, 1/framerate(ms): {1}",
                         new Object[]{difference, (1.0f / this.framerate) * 1000.0f});
             }

+ 3 - 1
jme3-android/src/main/java/com/jme3/input/android/AndroidJoyInput.java

@@ -209,7 +209,9 @@ public class AndroidJoyInput implements JoyInput {
 
     @Override
     public Joystick[] loadJoysticks(InputManager inputManager) {
-        logger.log(Level.INFO, "loading joysticks for {0}", this.getClass().getName());
+        if (logger.isLoggable(Level.INFO)) {
+            logger.log(Level.INFO, "loading joysticks for {0}", this.getClass().getName());
+        }
         if (!disableSensors) {
             joystickList.add(sensorJoyInput.loadJoystick(joystickList.size(), inputManager));
         }

+ 17 - 8
jme3-android/src/main/java/com/jme3/input/android/AndroidJoystickJoyInput14.java

@@ -51,6 +51,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -117,7 +118,9 @@ public class AndroidJoystickJoyInput14 {
         for (int deviceId : deviceIds) {
             InputDevice dev = InputDevice.getDevice(deviceId);
             int sources = dev.getSources();
-            logger.log(Level.FINE, "deviceId[{0}] sources: {1}", new Object[]{deviceId, sources});
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "deviceId[{0}] sources: {1}", new Object[]{deviceId, sources});
+            }
 
             // Verify that the device has gamepad buttons, control sticks, or both.
             if (((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) ||
@@ -143,10 +146,14 @@ public class AndroidJoystickJoyInput14 {
                     // type reported by Android into the jME Joystick axis
                     List<MotionRange> motionRanges = dev.getMotionRanges();
                     for (MotionRange motionRange: motionRanges) {
-                        logger.log(Level.INFO, "motion range: {0}", motionRange.toString());
-                        logger.log(Level.INFO, "axis: {0}", motionRange.getAxis());
+                        if (logger.isLoggable(Level.INFO)) {
+                            logger.log(Level.INFO, "motion range: {0}", motionRange);
+                            logger.log(Level.INFO, "axis: {0}", motionRange.getAxis());
+                        }
                         JoystickAxis axis = joystick.addAxis(motionRange);
-                        logger.log(Level.INFO, "added axis: {0}", axis);
+                        if (logger.isLoggable(Level.INFO)) {
+                            logger.log(Level.INFO, "added axis: {0}", axis);
+                        }
                     }
 
                     // InputDevice has a method for determining if a keyCode is
@@ -157,8 +164,10 @@ public class AndroidJoystickJoyInput14 {
                     // buttons being configured that don't exist on the specific
                     // device, but I haven't found a better way yet.
                     for (int keyCode: AndroidGamepadButtons) {
-                        logger.log(Level.INFO, "button[{0}]: {1}",
-                                new Object[]{keyCode, KeyCharacterMap.deviceHasKey(keyCode)});
+                        if (logger.isLoggable(Level.INFO)) {
+                            logger.log(Level.INFO, "button[{0}]: {1}",
+                                    new Object[]{keyCode, KeyCharacterMap.deviceHasKey(keyCode)});
+                        }
                         if (KeyCharacterMap.deviceHasKey(keyCode)) {
                             // add button even though we aren't sure if the button
                             // actually exists on this InputDevice
@@ -319,7 +328,7 @@ public class AndroidJoystickJoyInput14 {
             }
 
             String logicalId = JoystickCompatibilityMappings.remapButton( getName(), original );
-            if( logicalId == null ? original != null : !logicalId.equals(original) ) {
+            if (logger.isLoggable(Level.FINE) && !Objects.equals(logicalId, original)) {
                 logger.log(Level.FINE, "Remapped: {0} to: {1}",
                         new Object[]{original, logicalId});
             }
@@ -350,7 +359,7 @@ public class AndroidJoystickJoyInput14 {
                 original = JoystickAxis.POV_Y;
             }
             String logicalId = JoystickCompatibilityMappings.remapAxis( getName(), original );
-            if( logicalId == null ? original != null : !logicalId.equals(original) ) {
+            if (logger.isLoggable(Level.FINE) && !Objects.equals(logicalId, original)) {
                 logger.log(Level.FINE, "Remapped: {0} to: {1}",
                         new Object[]{original, logicalId});
             }

+ 27 - 15
jme3-android/src/main/java/com/jme3/input/android/AndroidSensorJoyInput.java

@@ -155,16 +155,20 @@ public class AndroidSensorJoyInput implements SensorEventListener {
         SensorData sensorData = sensors.get(sensorType);
         if (sensorData != null) {
             if (sensorData.enabled) {
-                logger.log(Level.FINE, "Sensor Already Active: SensorType: {0}, active: {1}",
-                        new Object[]{sensorType, sensorData.enabled});
+                if (logger.isLoggable(Level.FINE)) {
+                    logger.log(Level.FINE, "Sensor Already Active: SensorType: {0}, active: {1}",
+                            new Object[]{sensorType, sensorData.enabled});
+                }
                 return true;
             }
             sensorData.haveData = false;
             if (sensorData.sensor != null) {
                 if (sensorManager.registerListener(this, sensorData.sensor, sensorData.androidSensorSpeed)) {
                     sensorData.enabled = true;
-                    logger.log(Level.FINE, "SensorType: {0}, enabled: {1}",
-                            new Object[]{sensorType, sensorData.enabled});
+                    if (logger.isLoggable(Level.FINE)) {
+                        logger.log(Level.FINE, "SensorType: {0}, enabled: {1}",
+                                new Object[]{sensorType, sensorData.enabled});
+                    }
                     return true;
                 } else {
                     sensorData.enabled = false;
@@ -183,8 +187,10 @@ public class AndroidSensorJoyInput implements SensorEventListener {
             }
             sensorData.enabled = false;
             sensorData.haveData = false;
-            logger.log(Level.FINE, "SensorType: {0} deactivated, active: {1}",
-                    new Object[]{sensorType, sensorData.enabled});
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "SensorType: {0} deactivated, active: {1}",
+                        new Object[]{sensorType, sensorData.enabled});
+            }
         }
     }
 
@@ -409,9 +415,11 @@ public class AndroidSensorJoyInput implements SensorEventListener {
                                     "AndroidSensorsJoystick");
 
         List<Sensor> availSensors = sensorManager.getSensorList(Sensor.TYPE_ALL);
-        for (Sensor sensor: availSensors) {
-            logger.log(Level.FINE, "{0} Sensor is available, Type: {1}, Vendor: {2}, Version: {3}",
-                    new Object[]{sensor.getName(), sensor.getType(), sensor.getVendor(), sensor.getVersion()});
+        if (logger.isLoggable(Level.FINE)) {
+            for (Sensor sensor : availSensors) {
+                logger.log(Level.FINE, "{0} Sensor is available, Type: {1}, Vendor: {2}, Version: {3}",
+                        new Object[]{sensor.getName(), sensor.getType(), sensor.getVendor(), sensor.getVersion()});
+            }
         }
 
         // manually create orientation sensor data since orientation is not a physical sensor
@@ -575,10 +583,12 @@ public class AndroidSensorJoyInput implements SensorEventListener {
         int sensorType = sensor.getType();
         SensorData sensorData = sensors.get(sensorType);
         if (sensorData != null) {
-            logger.log(Level.FINE, "onAccuracyChanged for {0}: accuracy: {1}",
-                    new Object[]{sensor.getName(), i});
-            logger.log(Level.FINE, "MaxRange: {0}, Resolution: {1}",
-                    new Object[]{sensor.getMaximumRange(), sensor.getResolution()});
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "onAccuracyChanged for {0}: accuracy: {1}",
+                        new Object[]{sensor.getName(), i});
+                logger.log(Level.FINE, "MaxRange: {0}, Resolution: {1}",
+                        new Object[]{sensor.getMaximumRange(), sensor.getResolution()});
+            }
             sensorData.sensorAccuracy = i;
         }
     }
@@ -705,8 +715,10 @@ public class AndroidSensorJoyInput implements SensorEventListener {
         @Override
         public void calibrateCenter() {
             zeroRawValue = lastRawValue;
-            logger.log(Level.FINE, "Calibrating axis {0} to {1}",
-                    new Object[]{getName(), zeroRawValue});
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Calibrating axis {0} to {1}",
+                        new Object[]{getName(), zeroRawValue});
+            }
         }
 
     }

+ 4 - 2
jme3-android/src/main/java/com/jme3/input/android/AndroidTouchInput.java

@@ -133,9 +133,11 @@ public class AndroidTouchInput implements TouchInput {
             scaleX = settings.getWidth() / (float)androidInput.getView().getWidth();
             scaleY = settings.getHeight() / (float)androidInput.getView().getHeight();
         }
-        logger.log(Level.FINE, "Setting input scaling, scaleX: {0}, scaleY: {1}",
-                new Object[]{scaleX, scaleY});
 
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Setting input scaling, scaleX: {0}, scaleY: {1}",
+                    new Object[]{scaleX, scaleY});
+        }
 
     }
 

+ 17 - 9
jme3-android/src/main/java/com/jme3/system/android/AndroidConfigChooser.java

@@ -118,11 +118,15 @@ public class AndroidConfigChooser implements EGLConfigChooser {
             g = 6;
             b = 5;
         }
-        logger.log(Level.FINE, "Requested Display Config:");
-        logger.log(Level.FINE, "RGB: {0}, alpha: {1}, depth: {2}, samples: {3}, stencil: {4}",
-                new Object[]{settings.getBitsPerPixel(),
-                    settings.getAlphaBits(), settings.getDepthBits(),
-                    settings.getSamples(), settings.getStencilBits()});
+
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Requested Display Config:");
+            logger.log(Level.FINE, "RGB: {0}, alpha: {1}, depth: {2}, samples: {3}, stencil: {4}",
+                    new Object[]{settings.getBitsPerPixel(),
+                            settings.getAlphaBits(), settings.getDepthBits(),
+                            settings.getSamples(), settings.getStencilBits()});
+        }
+
         return new Config(
                 r, g, b,
                 settings.getAlphaBits(),
@@ -214,8 +218,10 @@ public class AndroidConfigChooser implements EGLConfigChooser {
             int st = eglGetConfigAttribSafe(egl, display, config,
                     EGL10.EGL_STENCIL_SIZE);
 
-            logger.log(Level.FINE, "Checking Config r: {0}, g: {1}, b: {2}, alpha: {3}, depth: {4}, samples: {5}, stencil: {6}",
-                    new Object[]{r, g, b, a, d, s, st});
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Checking Config r: {0}, g: {1}, b: {2}, alpha: {3}, depth: {4}, samples: {5}, stencil: {6}",
+                        new Object[]{r, g, b, a, d, s, st});
+            }
 
             if (higherRGB && r < requestedConfig.r) { continue; }
             if (!higherRGB && r != requestedConfig.r) { continue; }
@@ -243,8 +249,10 @@ public class AndroidConfigChooser implements EGLConfigChooser {
                 kr = r; kg = g; kb = b; ka = a;
                 kd = d; ks = s; kst = st;
                 keptConfig = config;
-                logger.log(Level.FINE, "Keeping Config r: {0}, g: {1}, b: {2}, alpha: {3}, depth: {4}, samples: {5}, stencil: {6}",
-                        new Object[]{r, g, b, a, d, s, st});
+                if (logger.isLoggable(Level.FINE)) {
+                    logger.log(Level.FINE, "Keeping Config r: {0}, g: {1}, b: {2}, alpha: {3}, depth: {4}, samples: {5}, stencil: {6}",
+                            new Object[]{r, g, b, a, d, s, st});
+                }
             }
 
         }

+ 6 - 4
jme3-android/src/main/java/com/jme3/system/android/JmeAndroidSystem.java

@@ -180,10 +180,12 @@ public class JmeAndroidSystem extends JmeSystemDelegate {
             default:
                 break;
         }
-        if (storageFolder != null) {
-            logger.log(Level.FINE, "Base Storage Folder Path: {0}", storageFolder.getAbsolutePath());
-        } else {
-            logger.log(Level.FINE, "Base Storage Folder not found!");
+        if (logger.isLoggable(Level.FINE)) {
+            if (storageFolder != null) {
+                logger.log(Level.FINE, "Base Storage Folder Path: {0}", storageFolder.getAbsolutePath());
+            } else {
+                logger.log(Level.FINE, "Base Storage Folder not found!");
+            }
         }
         return storageFolder;
     }

+ 7 - 3
jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java

@@ -314,7 +314,9 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex
     // SystemListener:reshape
     @Override
     public void onSurfaceChanged(GL10 gl, int width, int height) {
-        logger.log(Level.FINE, "GL Surface changed, width: {0} height: {1}", new Object[]{width, height});
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "GL Surface changed, width: {0} height: {1}", new Object[]{width, height});
+        }
         // update the application settings with the new resolution
         settings.setResolution(width, height);
         // reload settings in androidInput so the correct touch event scaling can be
@@ -412,8 +414,10 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex
 
     @Override
     public void requestDialog(final int id, final String title, final String initialValue, final SoftTextDialogInputListener listener) {
-        logger.log(Level.FINE, "requestDialog: title: {0}, initialValue: {1}",
-                new Object[]{title, initialValue});
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "requestDialog: title: {0}, initialValue: {1}",
+                    new Object[]{title, initialValue});
+        }
 
         final View view = JmeAndroidSystem.getView();
         view.getHandler().post(new Runnable() {

+ 4 - 2
jme3-bullet/src/common/java/com/jme3/bullet/animation/PhysicsLink.java

@@ -156,8 +156,10 @@ abstract public class PhysicsLink
         this.bone = bone;
         rigidBody = createRigidBody(mass, collisionShape);
 
-        logger.log(Level.FINE, "Creating link for bone {0} with mass={1}",
-                new Object[]{bone.getName(), rigidBody.getMass()});
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Creating link for bone {0} with mass={1}",
+                    new Object[]{bone.getName(), rigidBody.getMass()});
+        }
 
         this.localOffset = localOffset.clone();
         updateKPTransform();

+ 6 - 2
jme3-bullet/src/common/java/com/jme3/bullet/control/BetterCharacterControl.java

@@ -617,13 +617,17 @@ public class BetterCharacterControl extends AbstractPhysicsControl implements Ph
             } else {
                 newLeft.set(0f, direction.z, -direction.y).normalizeLocal();
             }
-            logger.log(Level.INFO, "Zero left for direction {0}, up {1}", new Object[]{direction, worldUpVector});
+            if (logger.isLoggable(Level.INFO)) {
+                logger.log(Level.INFO, "Zero left for direction {0}, up {1}", new Object[]{direction, worldUpVector});
+            }
         }
         newLeftNegate.set(newLeft).negateLocal();
         direction.set(worldUpVector).crossLocal(newLeftNegate).normalizeLocal();
         if (direction.equals(Vector3f.ZERO)) {
             direction.set(Vector3f.UNIT_Z);
-            logger.log(Level.INFO, "Zero left for left {0}, up {1}", new Object[]{newLeft, worldUpVector});
+            if (logger.isLoggable(Level.INFO)) {
+                logger.log(Level.INFO, "Zero left for left {0}, up {1}", new Object[]{newLeft, worldUpVector});
+            }
         }
         if (rotation != null) {
             rotation.fromAxes(newLeft, worldUpVector, direction);

+ 4 - 2
jme3-bullet/src/common/java/com/jme3/bullet/control/ragdoll/RagdollPreset.java

@@ -96,11 +96,13 @@ public abstract class RagdollPreset {
         JointPreset preset = boneMap.get(resultName);
 
         if (preset != null && resultScore >= 50) {
-            logger.log(Level.FINE, "Found matching joint for bone {0} : {1} with score {2}", new Object[]{boneName, resultName, resultScore});
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Found matching joint for bone {0} : {1} with score {2}", new Object[]{boneName, resultName, resultScore});
+            }
             preset.setupJoint(joint);
         } else {
             logger.log(Level.FINE, "No joint match found for bone {0}", boneName);
-            if (resultScore > 0) {
+            if (resultScore > 0 && logger.isLoggable(Level.FINE)) {
                 logger.log(Level.FINE, "Best match found is {0} with score {1}", new Object[]{resultName, resultScore});
             }
             new JointPreset().setupJoint(joint);

+ 6 - 2
jme3-core/src/main/java/com/jme3/anim/MorphControl.java

@@ -221,12 +221,16 @@ public class MorphControl extends AbstractControl implements Savable {
                 rm.preloadScene(spatial);
                 compilationOk = true;
             } catch (RendererException e) {
-                logger.log(Level.FINE, geom.getName() + ": failed at " + maxGPUTargets);
+                if (logger.isLoggable(Level.FINE)) {
+                    logger.log(Level.FINE, "{0}: failed at {1}", new Object[]{geom.getName(), maxGPUTargets});
+                }
                 // the compilation failed let's decrement the number of targets and try again.
                 maxGPUTargets--;
             }
         }
-        logger.log(Level.FINE, geom.getName() + ": " + maxGPUTargets);
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "{0}: {1}", new Object[]{geom.getName(), maxGPUTargets});
+        }
         // set the number of GPU morph on the geom to not have to recompute it next frame.
         geom.setNbSimultaneousGPUMorph(maxGPUTargets);
         return maxGPUTargets;

+ 3 - 1
jme3-core/src/main/java/com/jme3/app/LegacyApplication.java

@@ -538,7 +538,9 @@ public class LegacyApplication implements Application, SystemListener {
             settings = new AppSettings(true);
         }
 
-        logger.log(Level.FINE, "Starting application: {0}", getClass().getName());
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Starting application: {0}", getClass().getName());
+        }
         context = JmeSystem.newContext(settings, JmeContext.Type.Canvas);
         context.setSystemListener(this);
     }

+ 4 - 1
jme3-core/src/main/java/com/jme3/app/state/ScreenshotAppState.java

@@ -301,7 +301,10 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen
             } else {
                 file = new File(filePath + filename + ".png").getAbsoluteFile();
             }
-            logger.log(Level.FINE, "Saving ScreenShot to: {0}", file.getAbsolutePath());
+
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Saving ScreenShot to: {0}", file.getAbsolutePath());
+            }
 
             try {
                 writeImageFile(file);

+ 16 - 9
jme3-core/src/main/java/com/jme3/cinematic/events/AnimEvent.java

@@ -118,8 +118,10 @@ public class AnimEvent extends AbstractCinematicEvent {
      */
     @Override
     public void onPause() {
-        logger.log(Level.INFO, "layer={0} action={1}",
-                new Object[]{layerName, actionName});
+        if (logger.isLoggable(Level.INFO)) {
+            logger.log(Level.INFO, "layer={0} action={1}",
+                    new Object[]{layerName, actionName});
+        }
 
         Object layerManager = composer.getLayerManager(layerName);
         if (layerManager == this) {
@@ -133,8 +135,10 @@ public class AnimEvent extends AbstractCinematicEvent {
      */
     @Override
     public void onPlay() {
-        logger.log(Level.INFO, "layer={0} action={1}",
-                new Object[]{layerName, actionName});
+        if (logger.isLoggable(Level.INFO)) {
+            logger.log(Level.INFO, "layer={0} action={1}",
+                    new Object[]{layerName, actionName});
+        }
 
         Action currentAction = composer.getCurrentAction(layerName);
         Action eventAction = composer.action(actionName);
@@ -155,9 +159,10 @@ public class AnimEvent extends AbstractCinematicEvent {
      */
     @Override
     public void onStop() {
-        logger.log(Level.INFO, "layer={0} action={1}",
-                new Object[]{layerName, actionName});
-
+        if (logger.isLoggable(Level.INFO)) {
+            logger.log(Level.INFO, "layer={0} action={1}",
+                    new Object[]{layerName, actionName});
+        }
         Object layerManager = composer.getLayerManager(layerName);
         if (layerManager == this) {
             composer.removeCurrentAction(layerName);
@@ -217,8 +222,10 @@ public class AnimEvent extends AbstractCinematicEvent {
      */
     @Override
     public void setTime(float time) {
-        logger.log(Level.INFO, "layer={0} action={1} time={2}",
-                new Object[]{layerName, actionName, time});
+        if (logger.isLoggable(Level.INFO)) {
+            logger.log(Level.INFO, "layer={0} action={1} time={2}",
+                    new Object[]{layerName, actionName, time});
+        }
         super.setTime(time);
 
         Action currentAction = composer.getCurrentAction(layerName);

+ 61 - 22
jme3-core/src/main/java/com/jme3/input/JoystickCompatibilityMappings.java

@@ -176,38 +176,48 @@ public class JoystickCompatibilityMappings {
      * @return The new name for the axis, or just componentId if no remapping was provided.
      */
     public static String remapAxis(String joystickName, String componentId) {
-        logger.log(Level.FINE, "remapAxis(" + joystickName + ", " + componentId + ")");
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "remapAxis({0}, {1})", new Object[]{joystickName, componentId});
+        }
 
         // Always try the specific name first.
         joystickName = joystickName.trim();
         Map map = getAxisMappings(joystickName, false);
         if (map != null && map.containsKey(componentId)) {
-            logger.log(Level.FINE, "returning remapped axis:" + map.get(componentId));
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "returning remapped axis:{0}", map.get(componentId));
+            }
             return ((AxisData) map.get(componentId)).name;
         }
 
         map = getMappings(joystickName, false);
         if (map != null && map.containsKey(componentId)) {
-            logger.log(Level.FINE, "returning remapped axis:" + map.get(componentId));
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "returning remapped axis:{0}", map.get(componentId));
+            }
             return ((String) map.get(componentId));
         }
 
         // Try the normalized name
         joystickName = getNormalizedName(joystickName);
-        logger.log(Level.FINE, "normalized joystick name:" + joystickName);
+        logger.log(Level.FINE, "normalized joystick name:{0}", joystickName);
         if (joystickName == null) {
             return componentId;
         }
 
         map = getAxisMappings(joystickName, false);
         if (map != null && map.containsKey(componentId)) {
-            logger.log(Level.FINE, "returning remapped:" + map.get(componentId));
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "returning remapped:{0}", map.get(componentId));
+            }
             return ((AxisData) map.get(componentId)).name;
         }
 
         map = getMappings(joystickName, false);
         if (map != null && map.containsKey(componentId)) {
-            logger.log(Level.FINE, "returning remapped:" + map.get(componentId));
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "returning remapped:{0}", map.get(componentId));
+            }
             return ((String) map.get(componentId));
         }
 
@@ -222,39 +232,48 @@ public class JoystickCompatibilityMappings {
      * @return The new name for the button, or just componentId if no remapping was provided.
      */
     public static String remapButton(String joystickName, String componentId) {
-        logger.log(Level.FINE, "remapAxis(" + joystickName + ", " + componentId + ")");
-
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "remapAxis({0}, {1})", new Object[]{joystickName, componentId});
+        }
 
         // Always try the specific name first.
         joystickName = joystickName.trim();
         Map<String, String> map = getButtonMappings(joystickName, false);
         if (map != null && map.containsKey(componentId)) {
-            logger.log(Level.FINE, "returning remapped axis:" + map.get(componentId));
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "returning remapped axis:{0}", map.get(componentId));
+            }
             return map.get(componentId);
         }
 
         map = getMappings(joystickName, false);
         if (map != null && map.containsKey(componentId)) {
-            logger.log(Level.FINE, "returning remapped axis:" + map.get(componentId));
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "returning remapped axis:{0}", map.get(componentId));
+            }
             return map.get(componentId);
         }
 
         // Try the normalized name
         joystickName = getNormalizedName(joystickName);
-        logger.log(Level.FINE, "normalized joystick name:" + joystickName);
+        logger.log(Level.FINE, "normalized joystick name:{0}", joystickName);
         if (joystickName == null) {
             return componentId;
         }
 
         map = getButtonMappings(joystickName, false);
         if (map != null && map.containsKey(componentId)) {
-            logger.log(Level.FINE, "returning remapped:" + map.get(componentId));
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "returning remapped:{0}", map.get(componentId));
+            }
             return map.get(componentId);
         }
 
         map = getMappings(joystickName, false);
         if (map != null && map.containsKey(componentId)) {
-            logger.log(Level.FINE, "returning remapped:" + map.get(componentId));
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "returning remapped:{0}", map.get(componentId));
+            }
             return map.get(componentId);
         }
 
@@ -270,18 +289,22 @@ public class JoystickCompatibilityMappings {
      * @return the resulting axis/button name
      */
     public static String remapComponent(String joystickName, String componentId) {
-        logger.log(Level.FINE, "remapComponent(" + joystickName + ", " + componentId + ")");
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "remapComponent({0}, {1})", new Object[]{joystickName, componentId});
+        }
 
         // Always try the specific name first.
         joystickName = joystickName.trim();
         Map<String, String> map = getMappings(joystickName, false);
         if (map != null && map.containsKey(componentId)) {
-            logger.log(Level.FINE, "returning remapped:" + map.get(componentId));
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "returning remapped:{0}", map.get(componentId));
+            }
             return map.get(componentId);
         }
         // Try the normalized name
         joystickName = getNormalizedName(joystickName);
-        logger.log(Level.FINE, "normalized joystick name:" + joystickName);
+        logger.log(Level.FINE, "normalized joystick name:{0}", joystickName);
         if (joystickName == null) {
             return componentId;
         }
@@ -292,7 +315,9 @@ public class JoystickCompatibilityMappings {
         if (!map.containsKey(componentId)) {
             return componentId;
         }
-        logger.log(Level.FINE, "returning remapped:" + map.get(componentId));
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "returning remapped:{0}", map.get(componentId));
+        }
         return map.get(componentId);
     }
 
@@ -334,7 +359,10 @@ public class JoystickCompatibilityMappings {
      * @param remapId the remapped name
      */
     public static void addAxisMapping(String stickName, String sourceComponentId, String remapId) {
-        logger.log(Level.FINE, "addAxisMapping(" + stickName + ", " + sourceComponentId + ", " + remapId + ")");
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "addAxisMapping({0}, {1}, {2})",
+                    new Object[]{stickName, sourceComponentId, remapId});
+        }
         getAxisMappings(stickName, true).put(sourceComponentId, new AxisData(remapId, new float[0]));
     }
 
@@ -349,7 +377,10 @@ public class JoystickCompatibilityMappings {
      * @param range the desired range (not null, exactly 2 elements)
      */
     public static void addAxisMapping(String stickName, String sourceComponentId, String remapId, float[] range) {
-        logger.log(Level.FINE, "addAxisMapping(" + stickName + ", " + sourceComponentId + ", " + remapId + ")");
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "addAxisMapping({0}, {1}, {2})",
+                    new Object[]{stickName, sourceComponentId, remapId});
+        }
         if (range.length != 2) {
             throw new IllegalArgumentException("The range must have exactly 2 elements");
         }
@@ -366,7 +397,10 @@ public class JoystickCompatibilityMappings {
      * @param remapId the remapped name
      */
     public static void addButtonMapping(String stickName, String sourceComponentId, String remapId) {
-        logger.log(Level.FINE, "addButtonMapping(" + stickName + ", " + sourceComponentId + ", " + remapId + ")");
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "addButtonMapping({0}, {1}, {2})",
+                    new Object[]{stickName, sourceComponentId, remapId});
+        }
         getButtonMappings(stickName, true).put(sourceComponentId, remapId);
     }
 
@@ -380,7 +414,10 @@ public class JoystickCompatibilityMappings {
      * @param remapId the remapped name
      */
     public static void addMapping(String stickName, String sourceComponentId, String remapId) {
-        logger.log(Level.FINE, "addMapping(" + stickName + ", " + sourceComponentId + ", " + remapId + ")");
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "addMapping({0}, {1}, {2})",
+                    new Object[]{stickName, sourceComponentId, remapId});
+        }
         getMappings(stickName, true).put(sourceComponentId, remapId);
     }
 
@@ -476,7 +513,9 @@ public class JoystickCompatibilityMappings {
      * @param name the remapped name
      */
     public static void addJoystickNameRegex(String regex, String name) {
-        logger.log(Level.FINE, "addJoystickNameRegex(" + regex + ", " + name + ")");
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "addJoystickNameRegex({0}, {1})", new Object[]{regex, name});
+        }
         nameRemappings.put(Pattern.compile(regex), name);
     }
 

+ 10 - 6
jme3-core/src/main/java/com/jme3/material/Material.java

@@ -563,11 +563,13 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
         MatParamTexture paramDef = (MatParamTexture) def.getMaterialParam(name);
         if (paramDef.getColorSpace() != null && paramDef.getColorSpace() != value.getImage().getColorSpace()) {
             value.getImage().setColorSpace(paramDef.getColorSpace());
-            logger.log(Level.FINE, "Material parameter {0} needs a {1} texture, "
-                            + "texture {2} was switched to {3} color space.",
-                    new Object[]{name, paramDef.getColorSpace().toString(),
-                            value.getName(),
-                            value.getImage().getColorSpace().name()});
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Material parameter {0} needs a {1} texture, "
+                                + "texture {2} was switched to {3} color space.",
+                        new Object[]{name, paramDef.getColorSpace().toString(),
+                                value.getName(),
+                                value.getImage().getColorSpace().name()});
+            }
         } else if (paramDef.getColorSpace() == null && value.getName() != null && value.getImage().getColorSpace() == ColorSpace.Linear) {
             logger.log(Level.WARNING,
                     "The texture {0} has linear color space, but the material "
@@ -779,7 +781,9 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
                                 + "The capabilities %s are required.",
                                 name, def.getName(), lastTech.getRequiredCaps()));
             }
-            logger.log(Level.FINE, this.getMaterialDef().getName() + " selected technique def " + tech.getDef());
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, this.getMaterialDef().getName() + " selected technique def " + tech.getDef());
+            }
         } else if (technique == tech) {
             // attempting to switch to an already
             // active technique.

+ 3 - 1
jme3-core/src/main/java/com/jme3/renderer/Camera.java

@@ -289,7 +289,9 @@ public class Camera implements Savable, Cloneable {
         onViewPortChange();
         onFrameChange();
 
-        logger.log(Level.FINE, "Camera created (W: {0}, H: {1})", new Object[]{width, height});
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Camera created (W: {0}, H: {1})", new Object[]{width, height});
+        }
     }
 
     @Override

+ 5 - 2
jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java

@@ -1188,7 +1188,10 @@ public final class GLRenderer implements Renderer {
         if (loc < 0) {
             uniform.setLocation(-1);
             // uniform is not declared in shader
-            logger.log(Level.FINE, "Uniform {0} is not declared in shader {1}.", new Object[]{uniform.getName(), shader.getSources()});
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Uniform {0} is not declared in shader {1}.",
+                        new Object[]{uniform.getName(), shader.getSources()});
+            }
         } else {
             uniform.setLocation(loc);
         }
@@ -1514,7 +1517,7 @@ public final class GLRenderer implements Renderer {
             if (infoLog != null) {
                 logger.log(Level.WARNING, "{0} compiled successfully, compiler warnings: \n{1}",
                         new Object[]{source.getName(), infoLog});
-            } else {
+            } else if (logger.isLoggable(Level.FINE)) {
                 logger.log(Level.FINE, "{0} compiled successfully.", source.getName());
             }
             source.clearUpdateNeeded();

+ 3 - 1
jme3-core/src/main/java/com/jme3/scene/BatchNode.java

@@ -240,7 +240,9 @@ public class BatchNode extends GeometryGroupNode {
         }
 
 
-        logger.log(Level.FINE, "Batched {0} geometries in {1} batches.", new Object[]{nbGeoms, batches.size()});
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Batched {0} geometries in {1} batches.", new Object[]{nbGeoms, batches.size()});
+        }
 
         //init the temp arrays if something has been batched only.
         if (matMap.size() > 0) {

+ 4 - 2
jme3-core/src/main/java/com/jme3/scene/Geometry.java

@@ -730,8 +730,10 @@ public class Geometry extends Spatial {
                 material = im.getAssetManager().loadMaterial(matName);
             } catch (AssetNotFoundException ex) {
                 // Cannot find J3M file.
-                logger.log(Level.FINE, "Cannot locate {0} for geometry {1}",
-                        new Object[]{matName, key});
+                if (logger.isLoggable(Level.FINE)) {
+                    logger.log(Level.FINE, "Cannot locate {0} for geometry {1}",
+                            new Object[]{matName, key});
+                }
             }
         }
         // If material is NULL, try to load it from the geometry

+ 3 - 1
jme3-core/src/main/java/com/jme3/system/JmeSystemDelegate.java

@@ -82,7 +82,9 @@ public abstract class JmeSystemDelegate {
                 break;
         }
         if (storageFolder != null) {
-            logger.log(Level.FINE, "Storage Folder Path: {0}", storageFolder.getAbsolutePath());
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Storage Folder Path: {0}", storageFolder.getAbsolutePath());
+            }
         } else {
             logger.log(Level.FINE, "Storage Folder not found!");
         }

+ 3 - 1
jme3-core/src/main/java/com/jme3/system/NullContext.java

@@ -71,7 +71,9 @@ public class NullContext implements JmeContext, Runnable {
 
     protected void initInThread(){
         logger.fine("NullContext created.");
-        logger.log(Level.FINE, "Running on thread: {0}", Thread.currentThread().getName());
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Running on thread: {0}", Thread.currentThread().getName());
+        }
 
         Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
             @Override

+ 1 - 3
jme3-core/src/main/java/com/jme3/util/NativeObjectManager.java

@@ -237,9 +237,7 @@ public class NativeObjectManager {
             }
             
             realObj.resetObject();
-            if (logger.isLoggable(Level.FINEST)) {
-                logger.log(Level.FINEST, "Reset: {0}", realObj);
-            }
+            logger.log(Level.FINEST, "Reset: {0}", realObj);
         }
         refMap.clear();
         refQueue = new ReferenceQueue<Object>();

+ 9 - 4
jme3-core/src/tools/java/jme3tools/optimize/GeometryBatchFactory.java

@@ -493,7 +493,9 @@ public class GeometryBatchFactory {
             for (VertexBuffer buffer : geom.getMesh().getBufferList()) {
                 if (types.get(buffer.getBufferType()) == null) {
                     types.put(buffer.getBufferType(), buffer);
-                    logger.log(Level.FINE, buffer.getBufferType().toString());
+                    if (logger.isLoggable(Level.FINE)) {
+                        logger.log(Level.FINE, buffer.getBufferType().toString());
+                    }
                 }
                 Integer count = typesCount.get(buffer.getBufferType());
                 if (count == null) {
@@ -512,8 +514,9 @@ public class GeometryBatchFactory {
                         Integer count = typesCount.get(buffer.getBufferType());
                         if (count != null && count < geoms.size()) {
                             geom.getMesh().clearBuffer(buffer.getBufferType());
-                            logger.log(Level.FINE, "removing {0} from {1}", new Object[]{buffer.getBufferType(), geom.getName()});
-
+                            if (logger.isLoggable(Level.FINE)) {
+                                logger.log(Level.FINE, "removing {0} from {1}", new Object[]{buffer.getBufferType(), geom.getName()});
+                            }
                         }
                     }
                 }
@@ -538,7 +541,9 @@ public class GeometryBatchFactory {
                             }
                             vb.setupData(types.get(type).getUsage(), types.get(type).getNumComponents(), types.get(type).getFormat(), b);
                             geom.getMesh().setBuffer(vb);
-                            logger.log(Level.FINE, "geom {0} misses buffer {1}. Creating", new Object[]{geom.getName(), type});
+                            if (logger.isLoggable(Level.FINE)) {
+                                logger.log(Level.FINE, "geom {0} misses buffer {1}. Creating", new Object[]{geom.getName(), type});
+                            }
                         }
                     }
                 }

+ 6 - 2
jme3-core/src/tools/java/jme3tools/optimize/LodGenerator.java

@@ -353,7 +353,9 @@ public class LodGenerator {
             }
             if (tri.isMalformed()) {
                 if (!tri.isRemoved) {
-                    logger.log(Level.FINE, "malformed triangle found with ID:{0}\n{1} It will be excluded from Lod level calculations.", new Object[]{triangleList.indexOf(tri), tri.toString()});
+                    if (logger.isLoggable(Level.FINE)) {
+                        logger.log(Level.FINE, "malformed triangle found with ID:{0}\n{1} It will be excluded from Lod level calculations.", new Object[]{triangleList.indexOf(tri), tri.toString()});
+                    }
                     tri.isRemoved = true;
                     indexCount -= 3;
                 }
@@ -750,7 +752,9 @@ public class LodGenerator {
                 if (!tri.isRemoved) {
                     tri.isRemoved = true;
                     indexCount -= 3;
-                    logger.log(Level.FINE, "duplicate triangle found{0}{1} It will be excluded from Lod level calculations.", new Object[]{tri, duplicate});
+                    if (logger.isLoggable(Level.FINE)) {
+                        logger.log(Level.FINE, "duplicate triangle found{0}{1} It will be excluded from Lod level calculations.", new Object[]{tri, duplicate});
+                    }
                 }
             }
         }

+ 11 - 7
jme3-desktop/src/main/java/com/jme3/system/NativeLibraryLoader.java

@@ -537,9 +537,11 @@ public final class NativeLibraryLoader {
                         "The required native library '" + name + "'"
                         + " is not available for your OS: " + platform);
             } else {
-                logger.log(Level.FINE, "The optional native library ''{0}''" +
-                                       " is not available for your OS: {1}", 
-                                       new Object[]{name, platform});
+                if (logger.isLoggable(Level.FINE)) {
+                    logger.log(Level.FINE, "The optional native library ''{0}''" +
+                                    " is not available for your OS: {1}",
+                            new Object[]{name, platform});
+                }
                 return;
             }
         }
@@ -584,7 +586,7 @@ public final class NativeLibraryLoader {
                             "The required native library '" + unmappedName + "'"
                             + " was not found in the classpath via '" + pathInJar
                             + "'. Error message: " + e.getMessage());
-                } else {
+                } else if (logger.isLoggable(Level.FINE)) {
                     logger.log(Level.FINE, "The optional native library ''{0}''" + 
                                            " was not found in the classpath via ''{1}''" +
                                            ". Error message: {2}",
@@ -680,9 +682,11 @@ public final class NativeLibraryLoader {
                 try { out.close(); } catch (IOException ex) { }
             }
         }
-        
-        logger.log(Level.FINE, "Loaded native library from ''{0}'' into ''{1}''", 
-                   new Object[]{url, targetFile});
+
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Loaded native library from ''{0}'' into ''{1}''",
+                    new Object[]{url, targetFile});
+        }
     }
     
 }

+ 6 - 2
jme3-effects/src/main/java/com/jme3/post/filters/TranslucentBucketFilter.java

@@ -172,12 +172,16 @@ public final class TranslucentBucketFilter extends Filter {
                 emitter.getMaterial().setTexture("DepthTexture", processor.getDepthTexture());               
                 emitter.setQueueBucket(RenderQueue.Bucket.Translucent);
 
-                logger.log(Level.FINE, "Made particle Emitter {0} soft.", emitter.getName());
+                if (logger.isLoggable(Level.FINE)) {
+                    logger.log(Level.FINE, "Made particle Emitter {0} soft.", emitter.getName());
+                }
             } else {
                 emitter.getMaterial().clearParam("DepthTexture");
                 emitter.getMaterial().selectTechnique("Default", renderManager);
                // emitter.setQueueBucket(RenderQueue.Bucket.Transparent);
-                logger.log(Level.FINE, "Particle Emitter {0} is not soft anymore.", emitter.getName());
+                if (logger.isLoggable(Level.FINE)) {
+                    logger.log(Level.FINE, "Particle Emitter {0} is not soft anymore.", emitter.getName());
+                }
             }
         }
     }

+ 7 - 3
jme3-examples/src/main/java/jme3test/light/pbr/ConsoleProgressReporter.java

@@ -53,8 +53,10 @@ public class ConsoleProgressReporter extends JobProgressAdapter<LightProbe>{
     }
 
     @Override
-    public void progress(double value) {       
-        logger.log(Level.INFO, "Progress : {0}%", (value * 100));
+    public void progress(double value) {
+        if (logger.isLoggable(Level.INFO)) {
+            logger.log(Level.INFO, "Progress : {0}%", (value * 100));
+        }
     }
 
     @Override
@@ -65,7 +67,9 @@ public class ConsoleProgressReporter extends JobProgressAdapter<LightProbe>{
     @Override
     public void done(LightProbe result) {
         long end = System.currentTimeMillis();
-        logger.log(Level.INFO, "Generation done in {0}", (end - time) / 1000f);
+        if (logger.isLoggable(Level.INFO)) {
+            logger.log(Level.INFO, "Generation done in {0}", (end - time) / 1000f);
+        }
     }
     
 }

+ 9 - 6
jme3-ios/src/main/java/com/jme3/input/ios/IosInputHandler.java

@@ -48,8 +48,7 @@ public class IosInputHandler implements TouchInput {
 
     @Override
     public void update() {
-         logger.log(Level.FINE, "InputEvent update : {0}",
-                new Object[]{listener});
+         logger.log(Level.FINE, "InputEvent update : {0}", listener);
        if (listener != null) {
             InputEvent inputEvent;
 
@@ -134,8 +133,10 @@ public class IosInputHandler implements TouchInput {
         scaleY = 1.0f;
         width = settings.getWidth();
         height = settings.getHeight();
-        logger.log(Level.FINE, "Setting input scaling, scaleX: {0}, scaleY: {1}, width: {2}, height: {3}",
-                new Object[]{scaleX, scaleY, width, height});
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Setting input scaling, scaleX: {0}, scaleY: {1}, width: {2}, height: {3}",
+                    new Object[]{scaleX, scaleY, width, height});
+        }
     }
 
     public boolean isMouseEventsInvertX() {
@@ -176,8 +177,10 @@ public class IosInputHandler implements TouchInput {
     // ----------------
 
     public void injectTouchDown(int pointerId, long time, float x, float y) {
-        logger.log(Level.FINE, "Using input scaling, scaleX: {0}, scaleY: {1}, width: {2}, height: {3}",
-                new Object[]{scaleX, scaleY, width, height});
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Using input scaling, scaleX: {0}, scaleY: {1}, width: {2}, height: {3}",
+                    new Object[]{scaleX, scaleY, width, height});
+        }
         if (touchHandler != null) {
             touchHandler.actionDown(pointerId, time, x, y);
         }

+ 4 - 2
jme3-ios/src/main/java/com/jme3/input/ios/IosTouchHandler.java

@@ -70,8 +70,10 @@ public class IosTouchHandler {
     }
     
     public void actionDown(int pointerId, long time, float x, float y) {
-        logger.log(Level.FINE, "Inject input pointer: {0}, time: {1}, x: {2}, y: {3}", 
-                new Object[]{pointerId, time, x, y});
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Inject input pointer: {0}, time: {1}, x: {2}, y: {3}",
+                    new Object[]{pointerId, time, x, y});
+        }
         float jmeX = iosInput.getJmeX(x);
         float jmeY = iosInput.invertY(iosInput.getJmeY(y));
         TouchEvent touch = iosInput.getFreeTouchEvent();

+ 15 - 9
jme3-lwjgl/src/main/java/com/jme3/input/lwjgl/JInputJoyInput.java

@@ -48,6 +48,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import net.java.games.input.*;
@@ -246,9 +247,9 @@ public class JInputJoyInput implements JoyInput {
         }
 
         protected void addButton( Component comp ) {
-
-            logger.log(Level.FINE, "Adding button: \"{0}\" id:" + comp.getIdentifier(), comp);
-
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Adding button: \"{0}\" id:" + comp.getIdentifier(), comp);
+            }
             Identifier id = comp.getIdentifier();
             if( !(id instanceof Button) ) {
                 throw new IllegalArgumentException( "Component is not an button:" + comp );
@@ -262,7 +263,7 @@ public class JInputJoyInput implements JoyInput {
                 original = String.valueOf(buttonIndex.size());
             }
             String logicalId = JoystickCompatibilityMappings.remapButton( controller.getName(), original );
-            if( logicalId != original ) {
+            if (logger.isLoggable(Level.FINE) && !Objects.equals(logicalId, original)) {
                 logger.log(Level.FINE, "Remapped:" + original + " to:" + logicalId);
             }
 
@@ -273,8 +274,9 @@ public class JInputJoyInput implements JoyInput {
         }
 
         protected void addAxis( Component comp ) {
-
-            logger.log(Level.FINE, "Adding axis: \"{0}\" id:" + comp.getIdentifier(), comp );
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Adding axis: \"{0}\" id:" + comp.getIdentifier(), comp );
+            }
 
             Identifier id = comp.getIdentifier();
             if( !(id instanceof Axis) ) {
@@ -284,7 +286,7 @@ public class JInputJoyInput implements JoyInput {
             String name = comp.getName();
             String original = id.getName();
             String logicalId = JoystickCompatibilityMappings.remapAxis( controller.getName(), original );
-            if( logicalId != original ) {
+            if(logger.isLoggable(Level.FINE) && !Objects.equals(logicalId, original)) {
                 logger.log(Level.FINE, "Remapped:" + original + " to:" + logicalId);
             }
 
@@ -308,13 +310,17 @@ public class JInputJoyInput implements JoyInput {
                                                 this, getAxisCount(), JoystickAxis.POV_X,
                                                 id.getName() + "_x",
                                                 comp.isAnalog(), comp.isRelative(), comp.getDeadZone() );
-                logger.log(Level.FINE, "Adding axis: \"{0}\" id:" + id.getName() + "_x", povX.getName() );
+                if (logger.isLoggable(Level.FINE)) {
+                    logger.log(Level.FINE, "Adding axis: \"{0}\" id:" + id.getName() + "_x", povX.getName() );
+                }
                 addAxis(povX);
                 povY = new DefaultJoystickAxis( getInputManager(),
                                                 this, getAxisCount(), JoystickAxis.POV_Y,
                                                 id.getName() + "_y",
                                                 comp.isAnalog(), comp.isRelative(), comp.getDeadZone() );
-                logger.log(Level.FINE, "Adding axis: \"{0}\" id:" + id.getName() + "_y", povY.getName() );
+                if (logger.isLoggable(Level.FINE)) {
+                    logger.log(Level.FINE, "Adding axis: \"{0}\" id:" + id.getName() + "_y", povY.getName() );
+                }
                 addAxis(povY);
             }
 

+ 4 - 2
jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java

@@ -419,8 +419,10 @@ public abstract class LwjglContext implements JmeContext {
             return;
         }
         clPlatform = platform;
-        logger.log(Level.INFO, "chosen platform: {0}", platform.getName());
-        logger.log(Level.INFO, "chosen devices: {0}", chosenDevices);
+        if (logger.isLoggable(Level.INFO)) {
+            logger.log(Level.INFO, "chosen platform: {0}", platform.getName());
+            logger.log(Level.INFO, "chosen devices: {0}", chosenDevices);
+        }
         
         //create context
         try {

+ 3 - 1
jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglOffscreenBuffer.java

@@ -152,7 +152,9 @@ public class LwjglOffscreenBuffer extends LwjglContext implements Runnable {
     @Override
     public void run(){
         loadNatives();
-        logger.log(Level.FINE, "Using LWJGL {0}", Sys.getVersion());
+        if (logger.isLoggable(Level.FINE)) {
+            logger.log(Level.FINE, "Using LWJGL {0}", Sys.getVersion());
+        }
         initInThread();
         while (!needClose.get()){
             runLoop();

+ 4 - 2
jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java

@@ -141,8 +141,10 @@ public abstract class LwjglContext implements JmeContext {
     }
 
     protected void printContextInitInfo() {
-        logger.log(Level.INFO, "LWJGL {0} context running on thread {1}\n * Graphics Adapter: GLFW {2}",
-                APIUtil.toArray(Version.getVersion(), Thread.currentThread().getName(), GLFW.glfwGetVersionString()));
+        if (logger.isLoggable(Level.INFO)) {
+            logger.log(Level.INFO, "LWJGL {0} context running on thread {1}\n * Graphics Adapter: GLFW {2}",
+                    APIUtil.toArray(Version.getVersion(), Thread.currentThread().getName(), GLFW.glfwGetVersionString()));
+        }
     }
 
     protected int determineMaxSamples() {

+ 3 - 1
jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/FbxLoader.java

@@ -272,7 +272,9 @@ public class FbxLoader implements AssetLoader {
     private void applyBindPoses() {
         for (FbxBindPose bindPose : bindPoses) {
             Map<FbxId, Matrix4f> bindPoseData = bindPose.getJmeObject();
-            logger.log(Level.INFO, "Applying {0} bind poses", bindPoseData.size());
+            if (logger.isLoggable(Level.INFO)) {
+                logger.log(Level.INFO, "Applying {0} bind poses", bindPoseData.size());
+            }
             for (Map.Entry<FbxId, Matrix4f> entry : bindPoseData.entrySet()) {
                 FbxObject obj = objectMap.get(entry.getKey());
                 if (obj instanceof FbxNode) {