private void ensureHeader() throws java.io.IOException {
        byte[] hbytes = Utf8.toBytes(CFHEADER);
        byte[] rbytes = new byte[hbytes.length];

        ctlFile.seek(0);
        int l = ctlFile.read(rbytes);
        if (l != hbytes.length
            || !java.util.Arrays.equals(hbytes, rbytes))
        {
            StringBuilder sb = new StringBuilder();
            sb.append(CFHEADER);
            sb.append(CFPREPRE);
            int appLen = 0;
            if (appPrefix != null) {
                appLen = appPrefix.length();
                sb.append(appPrefix);
            }
            sb.append('\n');
            for (int i = appLen; i < maxPrefix + 2; i++) {
                sb.append(' ');
            }
            sb.append('\n');
            ctlFile.write(sb.toString().getBytes(US_ASCII));
            ctlFile.setLength(ctlFile.getFilePointer());
            if (ctlFile.getFilePointer() != (controlFileHeaderLength + 2)) {
                System.err.println("internal error, bad header length: "
                                   + ctlFile.getFilePointer()
                                   + " (should have been: "
                                   + (controlFileHeaderLength + 2)
                                   + ")");
            }
        }
    }
level controller for default levels (first-time logging
or logging without a logcontrol file)
vespalog/src/main/java/com/yahoo/log/VespaLevelControllerRepo.java