How to suppress info output?

When I run my application, it generates this output to the console:

Jan 03, 2023 11:14:48 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.5.2-stable
 * Branch: HEAD
 * Git Hash: 8ab3d24
 * Build Date: 2022-04-21
Jan 03, 2023 11:14:48 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 3.3.1 build 7 context running on thread jME3 Main
 * Graphics Adapter: GLFW 3.4.0 Win32 WGL Null EGL OSMesa VisualC DLL
Jan 03, 2023 11:14:48 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
 * Vendor: Intel
 * Renderer: Intel(R) UHD Graphics
 * OpenGL Version: 4.6.0 - Build 27.20.100.8984
 * GLSL Version: 4.60 - Build 27.20.100.8984
 * Profile: Compatibility
Jan 03, 2023 11:14:49 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer Information
 * Device: OpenAL Soft
 * Vendor: OpenAL Community
 * Renderer: OpenAL Soft
 * Version: 1.1 ALSOFT 1.21.1
 * Supported channels: 64
 * ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_device_clock ALC_SOFT_HRTF ALC_SOFT_loopback ALC_SOFT_loopback_bformat ALC_SOFT_output_limiter ALC_SOFT_pause_device
 * AL extensions: AL_EXT_ALAW AL_EXT_BFORMAT AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STEREO_ANGLES AL_LOKI_quadriphonic AL_SOFT_bformat_ex AL_SOFTX_bformat_hoa AL_SOFT_block_alignment AL_SOFTX_callback_buffer AL_SOFTX_convolution_reverb AL_SOFT_deferred_updates AL_SOFT_direct_channels AL_SOFT_direct_channels_remix AL_SOFT_effect_target AL_SOFT_events AL_SOFTX_filter_gain_ex AL_SOFT_gain_clamp_ex AL_SOFT_loop_points AL_SOFTX_map_buffer AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length AL_SOFT_source_resampler AL_SOFT_source_spatialize
Jan 03, 2023 11:14:49 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Jan 03, 2023 11:14:49 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 2

I would like to suppress that output.

I tried adding a call to Logger.getLogger(“com.jme3”).setLevel(Level.SEVERE) in my code, but I still get the output.

Here is my code:

package com._3dmathpuzzles.cubes;

import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AppState;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.system.JmeContext;
import com.propfinancing.jme3.ScreenshotAppStateWithCallbacks;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;

public class CubePuzzleGenerator extends SimpleApplication {  
  public CubePuzzleGenerator() {
    super((AppState[])null);
  }
  
  @Override
  public void simpleInitApp() {
    Logger.getLogger("com.jme3").setLevel(Level.SEVERE);
    
    Box b = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    Material mat = new Material(assetManager,"Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.White);
    geom.setMaterial(mat);
    rootNode.attachChild(geom);
    
    ScreenshotAppStateWithCallbacks ssAppState = new ScreenshotAppStateWithCallbacks(
        "C:"+File.separator+"Tmp"+File.separator, 
        "test");
    ssAppState.setIsNumbered(false);
    ssAppState.setWriteImageFileCallback(new Runnable() {
      @Override
      public void run() {
        stop();
      }
    });
    stateManager.attach(ssAppState);
    
    ssAppState.takeScreenshot();
  }
  
  public static void main(String[] args) {
    CubePuzzleGenerator generator = new CubePuzzleGenerator();
    generator.start(JmeContext.Type.OffscreenSurface);
  }
}

Any ideas why it is still happening?

JUL is probably the worst logging framework of all logging frameworks in the world. You can bet if there was a really stupid way to do something then they would have done it that way. I avoid it like a rat infested plague.

…but one of my recollections is that every piece of code that asks for a Logger gets its own instance and will then never see configuration updates after that point.

Meaning: if you set the logging level after some piece of code (say, JME) has already got its own Logger instances then it’s too late.

If you have a main() method, try putting the setting of log levels in there instead.

Edit: also note that right below your post (would have been the top post when you created your topic) is essentially the exact same question from someone else:
image

Which I mention because there has already been traffic there that might be useful to you.

OK, I added your LogAdapter to my code, and it allows me to use Log4j2. But, it has some System.out.printlns which generate this output:

Setting root JUL log level to:FINE
logger config:root
Setting JUL Log: level to:WARNING

It might be best to eventually change them into logging calls instead.

That worked, but I think I prefer to use Log4j2 as you suggested in the other thread.

Thanks for your help!

2 Likes