좋은 아침 윈도우 강타 콘솔에서 오류를 던지고있다. jar를 빌드하고 bash Windows에서 실행하면 "Console Appender"와 관련된 오류가 발생합니다. 조사한 후에, 다른 쉘 (git bash와 같은)에서 작동하지만, 여기에 내 문제는이 행동이 어딘가에 문서화되어 있는지에 관한 것입니다 (많은 것을 인터넷 검색 한 결과, 관련성이별로 없었습니다).왜 Log4j2이 모든 이클립스에서 확인했다, 그것을 실행 (구성 아래 참조) 내 프로젝트에 log4j2를 사용</p> <p>,
내 log4j2.properties : 여기
name=PropertiesConfig
property.directory = ./logs
appenders = console, file, testFile
appender.console.type = Console
appender.console.target =SYSTEM_OUT
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} line %L - %msg%n
appender.file.type = File
appender.file.append = false
appender.file.name = LOGFILE
appender.file.fileName=${directory}/neoswitcher-${date:yyyy-MM-dd-HH-mm-ss}.log
appender.file.layout.type=PatternLayout
appender.file.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
appender.testFile.type = File
appender.testFile.append = false
appender.testFile.name = LOGTestFILE
appender.testFile.fileName=${directory}/test-suite-${date:yyyy-MM-dd-HH-mm-ss}.log
appender.testFile.layout.type=PatternLayout
appender.testFile.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
loggers=file
logger.file.name=org.test.controller.core
logger.file.level = info
logger.file.appenderRefs = file
logger.file.appenderRef.file.ref = LOGFILE
loggers=file
logger.testFile.name=org.simpleperftests.core;
logger.testFile.level = info
logger.testFile.appenderRefs = testFile
logger.testFile.appenderRef.file.ref = LOGTestFILE
rootLogger.level = info
rootLogger.appenderRefs = stdout, file, testFile
rootLogger.appenderRef.stdout.ref = STDOUT
rootLogger.appenderRef.file.ref = LOGFILE
rootLogger.appenderRef.testFile.ref = LOGTestFILE
그리고 MS-DOS 콘솔에서 발생하는 오류 :
2017-02-24 10:55:11,994 main ERROR Unable to inject fields into builder class for plugin type class org.apache.logging.log4j.core.appender.ConsoleAppender, element Cons
ole. java.nio.charset.UnsupportedCharsetException: sun.stdout.encoding
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)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:551)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:537)
at org.test.controller.core.App.<clinit>(App.java:14)
2017-02-24 10:55:12,001 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console. java.lang.
IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.ConsoleAppender
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:224)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:130)
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)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:551)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:537)
at org.test.controller.core.App.<clinit>(App.java:14)
2017-02-24 10:55:12,012 main ERROR Null object returned for Console in Appenders.
2017-02-24 10:55:12,012 main ERROR Unable to locate appender "STDOUT" for logger config "root"
편집 : 그것은 실제로 버전으로 리눅스에서 잘 작동
"sun.stdout.encoding"캐릭터 세트가 아닙니다. 구성을 확인 했습니까? – Konrad
log4j2가 Windows bash 콘솔에서 감지하는 문자셋이라고 가정합니다. Windows bash의 charset을 수정하는 방법을 모르겠습니다 (특히이 컴퓨터에서 관리자 권한이 없음). – Adonis
이것은 Log4j2 메일 링리스트에 나온 유사한 문제를 상기시켜줍니다. JIRA 티켓. 문제를 제기 할 수 있습니까? –