Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1888

Log4j throws a java.nio.charset.UnsupportedCharsetException: cp65001

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.8.2
    • 2.9.0
    • Core
    • None

    Description

      Running a Java spring boot web application using a "java -jar" type of command with a pretty vanilla log4j2.xml file in it, I see the following error.

      2017-04-24 11:47:45,338 main ERROR Unable to inject fields into builder class for plugin type class org.apache.logging.log4j.core.appender.ConsoleAppender, element Console. java.nio.charset.UnsupportedCharsetException: cp65001
              at java.nio.charset.Charset.forName(Charset.java:531)
              at org.apache.logging.log4j.util.PropertiesUtil.getCharsetProperty(PropertiesUtil.java:146)
              at org.apache.logging.log4j.util.PropertiesUtil.getCharsetProperty(PropertiesUtil.java:134)
              at org.apache.logging.log4j.core.appender.ConsoleAppender$Target.getCharset(ConsoleAppender.java:85)
              at org.apache.logging.log4j.core.appender.ConsoleAppender$Target$1.getDefaultCharset(ConsoleAppender.java:71)
              at org.apache.logging.log4j.core.appender.ConsoleAppender$Builder.build(ConsoleAppender.java:218)
              at org.apache.logging.log4j.core.appender.ConsoleAppender$Builder.build(ConsoleAppender.java:185)
              at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
              at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
              at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892)
              at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884)
              at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
              at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
              at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
      

      I am running the "run" command on Windows 10 64x inside a ConEmu console. If I switch to Babun, then I don't see the error.

      This may not exactly be a "bug", but it would be great to not crash the app and fallback to a more accepting encoding perhaps.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mmoayyed Misagh Moayyed
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: