Initializes the logger. This is called when we need to create a new
logger for the given file name.

@param fileStr
@return a new Logger instance for the given fileStr
@throws IOException
338224
protected Logger initLogger(String fileStr) throws IOException {
		String loggerName = "NagiosWriter" + this.hashCode();

		final PatternLayoutEncoder encoder = new PatternLayoutEncoder();
		encoder.setContext(loggerContext);
		encoder.setPattern(LOG_PATTERN);
		encoder.start();

		final FileAppender appender = new FileAppender();
		appender.setContext(loggerContext);
		appender.setName(loggerName + "File");
		appender.setAppend(true);
		appender.setBufferSize(new FileSize(LOG_IO_BUFFER_SIZE_BYTES));
		appender.setFile(fileStr);
		appender.setEncoder(encoder);
		appender.start();

		Logger logger = loggerContext.getLogger(loggerName);
		logger.addAppender(appender);
		logger.setLevel(Level.INFO);
		logger.setAdditive(false);

		return logger;
	}
830915
def add_file_handler(logger, logFilename=None):
    
    assert isinstance(logger, logging.Logger)
    ch = logging.FileHandler(logFilename, "a")
    # ch.setFormatter(logging._defaultFormatter) # todo may change to have same formatter as last handler of logger
    ch.setFormatter(_fmtr)
    logger.addHandler(ch)
149319
public static void initialize(String loggerLevel) {
        if (!INIT.compareAndSet(false, true)) {
            return;
        }

        BasicConfigurator.resetConfiguration();
        ConsoleAppender consoleAppender = new ConsoleAppender(
            new PatternLayout("<%d{yyMMdd HHmmss} %5p %C{1}:%L> %m%n"), ConsoleAppender.SYSTEM_ERR);
        BasicConfigurator.configure(consoleAppender);

        Level level;

        String logLevel;

        if (loggerLevel != null) {
            logLevel = loggerLevel.toLowerCase();
        } else {
            logLevel = "default";
        }

        switch (logLevel) {
            case "all":
                level = Level.ALL;
                break;
            case "debug":
                level = Level.DEBUG;
                break;
            case "error":
                level = Level.ERROR;
                break;
            case "fatal":
                level = Level.FATAL;
                break;
            case "info":
                level = Level.INFO;
                break;
            case "off":
                level = Level.OFF;
                break;
            case "trace":
                level = Level.TRACE;
                break;
            case "warn":
                level = Level.WARN;
                break;
            default:
                level = Level.INFO;
                break;
        }

        Logger.getRootLogger().setLevel(Level.OFF);
        Logger.getLogger("org.finra").setLevel(level);

        System.err.println("Set loglevel to " + level.toString());
    }
936787
public void init() {
        if (logger != null && StringUtils.isNotEmpty(name)) {
            if (logger.isWarnEnabled() && !ConfigUtils.isFilePath(name)) {
                try {
                    List<String> realPaths = new ArrayList<String>();
                    Enumeration<URL> e = Thread.currentThread().getContextClassLoader().getResources(name);
                    while (e.hasMoreElements()) {
                        URL url = (URL) e.nextElement();
                        realPaths.add(url.getFile());
                    }
                    if (realPaths.size() > 1) {
                        logger.warn("Multi httl config in classpath, conflict configs: " + realPaths + ". Please keep only one config.");
                    }
                } catch (IOException e) {
                    logger.error(e.getMessage(), e);
                }
            }
            if (logger.isInfoEnabled()) {
                String realPath = ConfigUtils.getRealPath(name);
                if (StringUtils.isNotEmpty(realPath)) {
                    logger.info("Load httl config from " + realPath + " in " + (name.startsWith("/") ? "filesystem" : "classpath") + ".");
                }
            }
        }
    }
1277263
public void init(InputStream in) throws IOException 
    {
        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.logp(Level.FINE, CLASS_NAME,"init", "init"); 
        } 
        this.in = in;
        next();
        obs=null;
    }
1306303
def init_logger(cls, log_level):
        """"""
        logger = logging.getLogger("AutoMLBoard")
        handler = logging.StreamHandler()
        formatter = logging.Formatter("[%(levelname)s %(asctime)s] "
                                      "%(filename)s: %(lineno)d  "
                                      "%(message)s")
        handler.setFormatter(formatter)
        logger.setLevel(log_level)
        logger.addHandler(handler)
        return logger
534110
private static void initializeLogFactory() {
    ServiceLoader<LogFactory> loader = ServiceLoader.load(LogFactory.class);
    for (LogFactory lf : loader) {
      logFactory = lf;
      log("New instance, using: " + logFactory.getClass().getName());
      return;
    }
    try {
      final org.slf4j.ILoggerFactory lf = org.slf4j.LoggerFactory.getILoggerFactory();
      logFactory = new LogFactory() {
        @Override
        public Log getLog(String s) {
          return new Slf4jLogger(lf.getLogger(s));
        }
      };
      log("New instance, using SLF4J logging");
      return;
    } catch (NoClassDefFoundError ignore) {
    }
    try {
      final org.apache.commons.logging.LogFactory cl =
        org.apache.commons.logging.LogFactory.getFactory();
      logFactory = new LogFactory() {
        @Override
        public Log getLog(String s) {
          return new CommonsLogger(cl.getInstance(s));
        }
      };
      log("New instance, using commons logging");
      return;
    } catch (NoClassDefFoundError ignore) {
    }
    logFactory = new LogFactory() {
      @Override
      public Log getLog(String s) {
        return new JdkLogger(Logger.getLogger(s));
      }
    };
    log("New instance, using JDK logging");
  }
568196
def _init_file_logger(logger, level, log_path, log_size, log_count):
    
    if level not in [logging.NOTSET, logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL]:
        level = logging.DEBUG

    for h in logger.handlers:
        if isinstance(h, logging.handlers.RotatingFileHandler):
            if h.level == level:
                return

    fh = logging.handlers.RotatingFileHandler(
        log_path, maxBytes=log_size, backupCount=log_count)
    fh.setLevel(level)
    fh.setFormatter(_formatter)
    logger.addHandler(fh)
611585
private void initialize()
	{
		Log.addLogListener(new LogMessageCallBack()
		{
			@Override
			public void debug(String message)
			{
				showMessage(message);
			}
			@Override
			public void info(String message)
			{
				showMessage(message);
			}
			@Override
			public void error(String message, Throwable ex)
			{
				if (ex!=null)
					showMessage(message+'|'+ex.toString());
				else
					showMessage(message);
			}
		});
		
		readPropertyFile();
		
		setSystemTray();

		setName(WINDOW_NAME);
		setTitle(WINDOW_TITLE);
		getTrayIcon().setToolTip(WINDOW_TITLE);

		java.net.URL iconURL = MainForm.class.getResource(DEFAULTICONPATH);
	    if (iconURL!=null) 
	    	setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage(iconURL));
		
	    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
	    addWindowListener(new java.awt.event.WindowAdapter()
		{
			@Override
			public void windowClosing(java.awt.event.WindowEvent e)
			{
				doClose();
			}
			/**
			 * @param e
			 * @see java.awt.event.WindowAdapter#windowIconified(java.awt.event.WindowEvent)
			 * @since 07.02.2012
			 */
			@Override
			public void windowIconified(WindowEvent e)
			{
				if (useSystemTray) setVisible(false);
			}
			/**
			 * @param e
			 * @see java.awt.event.WindowAdapter#windowDeiconified(java.awt.event.WindowEvent)
			 * @since 07.02.2012
			 */
			@Override
			public void windowDeiconified(WindowEvent e)
			{
				if (useSystemTray) setVisible(true);
			}
		});
	    setSize(mainDialogSize);
		setPreferredSize(mainDialogSize);
		
		setJMenuBar(getBaseMenuBar());
		setContentPane(getBaseContentPane());
	    setPlayListIcons();
		// Volumecontrol by mousewheel:
	    addMouseWheelListener(new MouseWheelVolumeControl());
	    pack();

		createAllWindows();
		
		updateLookAndFeel(uiClassName);

		if (mainDialogLocation == null || (mainDialogLocation.getX()==-1 || mainDialogLocation.getY()==-1))
			mainDialogLocation = Helpers.getFrameCenteredLocation(this, null); 
	    setLocation(mainDialogLocation);
	    getModInfoDialog().setVisible(modInfoDialogVisable);
		getPlaylistDialog().setVisible(playlistDialogVisable);
		getEffectDialog().setVisible(effectDialogVisable);
		getPlayerSetUpDialog().setVisible(playerSetUpDialogVisable);

		dropTargetList = new ArrayList<DropTarget>();
	    PlaylistDropListener myListener = new PlaylistDropListener(this);
	    Helpers.registerDropListener(dropTargetList, this, myListener);
	    
		MultimediaContainerManager.addMultimediaContainerEventListener(this);
		
		createFileFilter();

	    currentContainer = null; //set Back to null!
	    showMessage("Ready...");
	}
910484
public static String file(String filePath) throws IOException {
        File f = new File(filePath);
        return file(f);
    }
399653
protected LogFileReader createNewReader(LogFileReader other) throws IOException {
		if (other instanceof LogFileReaderImpl) {
			return new LogFileReaderImpl((LogFileReaderImpl)other);
		}
		throw new IOException("Instance of the " + other.getClass().getName() + " is not clonable by " + OneLogFileRecordIterator.class.getName() + ".");
	}
542068
private void initOut() throws IOException
   {
      if (out == null)
      {
         FileOutputStream os = PrivilegedFileHelper.fileOutputStream(logFile, false);
         out = os.getChannel();
      }
   }
350289
function initFileLogger(filepath) {
  currentFilePath = filepath || currentFilePath;

  var logDir = path.dirname(currentFilePath);
  appenders.push(logToFile);
  if(!fs.existsSync(logDir)) fs.mkdirSync(logDir);
}
1269773
public void initFromFile(final String filename) {
		try (final InputStream is = new FileInputStream(filename)) {
			init(is);
		} catch (IOException e) {
			initBackToDefaults();
		}
	}
455890
public void init(String path, String charset) throws IOException {
		BufferedReader reader = FileUtil.getReader(path, charset);
		try {
			String line;
			while(true) {
				line = reader.readLine();
				if(line == null) {
					break;
				}
				this.add(line);
			}
		}finally {
			IoUtil.close(reader);
		}
	}
951002
public void initialize() {
        val pair = buildLoggerContext(environment, resourceLoader);
        pair.ifPresent(it -> {
            this.logConfigurationFile = it.getKey();
            this.loggerContext = it.getValue();
        });
    }
108744
@Override
  public void create()
    throws IOException
  {
    Files.createDirectories(_path.getParent());

    if (Files.exists(_path)) {
      throw new IOException(L.l("CREATE for path '{0}' failed, because the file already exists.  CREATE can not override an existing table.",
                                _path));
    }
    
    init();
    /*
    _channel = _path.openFileChannel(StandardOpenOption.CREATE, 
                                     StandardOpenOption.WRITE,
                                     StandardOpenOption.READ);
    
    setFileSize(_path.length());
    
    initImpl();
    */
  }