private LevelController getLevelControl(String suffix) {
        LevelController ctrl = null;
        if (levelControllerRepo != null) {
            if (suffix == null || suffix.equals("default")) {
                suffix = "";
            }
            ctrl = levelControllerRepo.getLevelController(suffix);
            if (ctrl != null) {
                return ctrl;
            }
            synchronized(this) {
                if (ctlFile == null) {
                    return defaultLevelCtrl;
                }
                LevelController inherit;

                int lastdot = suffix.lastIndexOf('.');
                if (lastdot != -1) {
                    // inherit from level above
                    inherit = getLevelControl(suffix.substring(0, lastdot));
                } else if (suffix.equals("")) {
                    // the one and only toplevel inherits from other mechanism
                    inherit = defaultLevelCtrl;
                } else {
                    // everything else inherits from toplevel
                    inherit = getLevelControl("");
                }
                try {
                    long len = ctlFile.length();
                    StringBuilder sb = new StringBuilder();
                    if (suffix.equals("")) {
                        sb.append("default: ");
                    } else {
                        sb.append(".").append(suffix).append(": ");
                    }
                    while ((len + sb.length()) % 4 != 0) {
                        sb.append(" ");
                    }
                    sb.append(inherit.getOnOffString()).append("\n");
                    byte[] lineBytes = sb.toString().getBytes(US_ASCII);
                    ctlFileAppender.write(lineBytes);
                    ctlFileAppender.flush();
                    ctlFile.seek(ctlFile.length());
                    extendMapping();
                    ctrl = levelControllerRepo.getLevelController(suffix);
                } catch(java.nio.channels.ClosedByInterruptException e) {
                    // happens during shutdown, ignore
                    // System.err.println("interrupt, reset logcontrol file: "+e);
                    resetCtlFile();
                } catch(java.io.IOException e) {
                    System.err.println("error extending logcontrol file: "+e);
                    e.printStackTrace();
                    resetCtlFile();
                }
            }
        }
        if (ctrl == null) {
            return defaultLevelCtrl;
        } else {
            return ctrl;
        }
    }
level controller for default levels (first-time logging
or logging without a logcontrol file)
vespalog/src/main/java/com/yahoo/log/VespaLevelControllerRepo.java