Logging level inconsistency between MP3File and AudioFileWriter

Issue #135 resolved
Dan Gravell created an issue

MP3File:

        if (!Files.isWritable(path))
        {
            logger.severe(Permissions.displayPermissions(path));
            logger.severe(ErrorMessage.GENERAL_WRITE_FAILED.getMsg(file.getName()));
            throw new IOException(ErrorMessage.GENERAL_WRITE_FAILED.getMsg(file.getName()));
        }

AudioFileWriter:

        if (!Files.isWritable(file))
        {
            logger.warning(Permissions.displayPermissions(file));
            logger.severe(ErrorMessage.GENERAL_WRITE_FAILED.getMsg(af.getFile()
                    .getPath()));
            throw new CannotWriteException(ErrorMessage.GENERAL_WRITE_FAILED_TO_OPEN_FILE_FOR_EDITING
                    .getMsg(file));
        }

Why are the displayPermissions saved at warning for one file, and severe for the other?

Comments (5)

  1. Dan Gravell reporter

    Fair enough :) I filter the logs to not include warnings atm, which is probably a bad idea, just noticed this.

  2. Dan Gravell reporter

    I find it a difficult question to answer! Blue sky opinion is that it should be built into the API and permission failures are not really "exceptional" but that's just a subjective opinion.

    You could also define a different logger to accept this info so the level could be adjusted as suits.

    For me it works out best if they are severe because at WARN there's other stuff that gets muddled in there. There's also the case of aligning them with the other logs within the if block. But I have a feeling someone else might have a different use case.

    Most importantly I think they should all (all the logs in the blocks above) be the same.

    So my vote for the easiest possible fix is to change them all to severe.

  3. IJabz repo owner

    Fixed, set to Level.SEVERE, also made logging behaviour consistent whenever checking permissions in advance

  4. Log in to comment