java.io.IOException: Couldn't get lock for

Catheryan picture Catheryan · Nov 21, 2013 · Viewed 19.2k times · Source

Get error as

"java.io.IOException: Couldn't get lock for ..\log\abc.log", not sure why this happen.

Can somebody help me out? Thank you

        logger = LogManager.getLogManager().getLogger(className);
        FileHandler logFile = new FileHandler(file);

        // create txt Formatter
        SimpleFormatter formatterTxt = new SimpleFormatter();
        logFile.setFormatter(formatterTxt);         
        logger.addHandler(logFile);

Answer

Jeril Kuruvila picture Jeril Kuruvila · Jan 24, 2014

@Catheryan

I also had the same issue. For me issue was:

private static final String FILE_PATH="/home/jeril/Logs.log";
handler = new FileHandler(FILE_PATH);

FILE_PATH was WRONG