Customize iOS Logging

iOS logging is handled by, which overrides java.util.logging.Handler. You can set it as the default by adding a resource to your app, as shown in LogManager.

Changing the Logging Handler Programmatically

To programmatically add a logging handler, use the same code you would use to change it in Java:


If you don't want the existing handler(s) to also run, remove them first using:

Logger logger = LogManager.getLogger("");
for (Handler h : logger.getHandlers()) {

Changing the Logging Handler with a Property File

  1. To change the default logging handler using a file, you have to specify that handler like this (the same as with Java applications):


    This file can have any name, as long as that name is used during loading.

  2. Next, add the file as an iOS resource to your project.

  3. Unlike with Java applications, a J2ObjC application needs to explicitly load the property file:

    static {
      // Fetch a logger in case the following leaves logging in a bad state, such
      // as not adding the resource or using a different name.
      Logger log = Logger.getLogger("configLogger");
      try {
        InputStream loggingProperties = SomeClass.class.getResourceAsStream("");
      } catch (IOException exception) {
        log.log(Level.SEVERE, "Error in loading configuration", exception);