Skip to content

WindowsAnsiOutputSteam warnings in log4j2 #134

@calvertdw

Description

@calvertdw

When using jansi I get multiple of the following warning messages in the console:

2018-12-14 11:31:45,437 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream due to java.io.IOException: Could not get the screen info: T h e   h a n d l e   i s   i n v a l i d .

May I suggest adding the following code to WindowsAnsiOutputStream to at least format the warning better:

if (GetConsoleScreenBufferInfo(console, info) == 0) {
    String lastErrorMessage = WindowsSupport.getLastErrorMessage().trim().replaceAll("\0", "");
    throw new IOException("Could not get the screen info: " + lastErrorMessage);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions