带有第 3 方附加程序的 log4j2
log4j2 with 3rd party appenders
我正在尝试在 java 应用程序(这是一个网络 API)中设置一些第三方附加程序 - 附加程序是作为依赖项添加的库。这是一个 Maven 应用程序,这些库是 Raven(通过 Sentry)和 Logentries。他们接受日志并提供 GUI 来查看它们。
在本地一切正常 - 当 运行 整个应用程序的本地日志成功显示在 Logentries 和 Sentry 中时。在两种环境中都成功找到并解析了配置。下面包含我的 log4j2.xml
配置和为这两种环境启动服务器时的输出。
在暂存环境中,我看到日志显示 CLASS_NOT_FOUND
,所以这可能是 class 路径问题?有什么想法吗?
配置
<?xml version="1.0" encoding="utf-8"?>
<configuration status="all">
<properties>
<property name="pattern">%d{hh:mm:ss.sss} [mode=${env:MODE}] [%t] %-5level %logger{36} - %msg%n</property>
</properties>
<appenders>
<console name="console" target="system_out">
<patternlayout pattern="${pattern}"/>
</console>
<raven name="sentry">
<dsn>[dsn_here]</dsn>
<patternlayout pattern="${pattern}"/>
<!--to turn down the noise-->
<!--<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>-->
</raven>
<logentries name="le">
<token>[token_here]</token>
<patternlayout pattern="${pattern}"/>
<!--to turn down the noise-->
<!--<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>-->
</logentries>
</appenders>
<loggers>
<root level="debug">
<appender-ref ref="le"/>
<appender-ref ref="sentry"/>
<appender-ref ref="console"/>
</root>
<logger name="com.amazonaws" level="debug" additivity="false">
<appender-ref ref="console"/>
</logger>
</loggers>
</configuration>
启动服务器时的暂存环境输出
Oct 13 20:21:23 dev-company1 java: 2016-10-13 20:21:23,723 main DEBUG Initializing configuration XmlConfiguration[location=jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml]
Oct 13 20:21:23 dev-company1 java: 2016-10-13 20:21:23,729 main DEBUG Installed script engines
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,282 main DEBUG Oracle Nashorn Version: 1.8.0_101, Language: ECMAScript, Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript}
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,283 main DEBUG PluginManager 'Core' found 99 plugins
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,283 main DEBUG PluginManager 'Level' found 0 plugins
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,285 main ERROR Error processing element raven ([appenders: null]): CLASS_NOT_FOUND
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,286 main ERROR Error processing element logentries ([appenders: null]): CLASS_NOT_FOUND
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,288 main DEBUG No scheduled items
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,289 main DEBUG Building Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,303 main TRACE TypeConverterRegistry initializing.
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,303 main DEBUG PluginManager 'TypeConverter' found 23 plugins
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,317 main DEBUG createProperty(name="pattern", value="%d{hh:mm:ss.sss} [mode=dev] [%t] %-5level %logger{36} - %msg%n")
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,317 main DEBUG Building Plugin[name=properties, class=org.apache.logging.log4j.core.config.PropertiesPlugin].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,326 main DEBUG configureSubstitutor(={pattern=%d{hh:mm:ss.sss} [mode=dev] [%t] %-5level %logger{36} - %msg%n}, Configuration(jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml))
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,327 main DEBUG PluginManager 'Lookup' found 13 plugins
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,328 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,332 main DEBUG PatternLayout$Builder(pattern="%d{hh:mm:ss.sss} [mode=dev] [%t] %-5level %logger{36} - %msg%n", PatternSelector=null, Configuration(jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null")
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,332 main DEBUG PluginManager 'Converter' found 41 plugins
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,366 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,367 main DEBUG PluginManager 'Converter' found 41 plugins
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,367 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false-2
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,381 main DEBUG ConsoleAppender$Builder(patternlayout(%d{hh:mm:ss.sss} [mode=dev] [%t] %-5level %logger{36} - %msg%n), Filter=null, target="SYSTEM_OUT", name="console", follow="null", direct="null", ignoreExceptions="null")
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,381 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,381 main DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,382 main DEBUG createAppenders(={console})
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,382 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,383 main DEBUG createAppenderRef(ref="le", level="null", Filter=null)
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,383 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,383 main DEBUG createAppenderRef(ref="sentry", level="null", Filter=null)
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,383 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,384 main DEBUG createAppenderRef(ref="console", level="null", Filter=null)
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,384 main DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,385 main DEBUG createLogger(additivity="null", level="DEBUG", includeLocation="null", ={le, sentry, console}, ={}, Configuration(jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml), Filter=null)
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,386 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,387 main DEBUG createAppenderRef(ref="console", level="null", Filter=null)
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,387 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,390 main DEBUG createLogger(additivity="false", level="DEBUG", name="com.amazonaws", includeLocation="null", ={console}, ={}, Configuration(jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml), Filter=null)
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,391 main DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,401 main DEBUG createLoggers(={root, com.amazonaws})
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,401 main ERROR Unable to locate appender "le" for logger config "root"
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,401 main ERROR Unable to locate appender "sentry" for logger config "root"
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,402 main DEBUG Configuration XmlConfiguration[location=jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml] initialized
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,402 main DEBUG Starting configuration XmlConfiguration[location=jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml]
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,402 main DEBUG Started configuration XmlConfiguration[location=jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml] OK.
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,403 main TRACE Stopping org.apache.logging.log4j.core.config.DefaultConfiguration@531d72ca...
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,403 main TRACE DefaultConfiguration notified 1 ReliabilityStrategies that config will be stopped.
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,403 main TRACE DefaultConfiguration stopping root LoggerConfig.
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,404 main TRACE DefaultConfiguration notifying ReliabilityStrategies that appenders will be stopped.
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,404 main TRACE DefaultConfiguration stopping remaining Appenders.
Oct 13 20:21:45 dev-company1 journal: Suppressed 692 messages from /system.slice/company.service
Oct 13 20:21:45 dev-company1 java: 08:21:45.045 [mode=dev] [cluster-ClusterId{value='57ffecc465bab830ccd6f372', description='null'}-dev-mongo2:27017] DEBUG org.mongodb.driver.cluster - Checking status of dev-mongo2:27017
Oct 13 20:21:45 dev-company1 java: 08:21:45.045 [mode=dev] [cluster-ClusterId{value='57ffecc465bab830ccd6f372', description='null'}-dev-mongo2:27017] DEBUG org.mongodb.driver.cluster - Updating cluster description to {type=REPLICA_SET, servers=[{address=dev-mongo2:27017, type=REPLICA_SET_PRIMARY, roundTripTime=9.2 ms, state=CONNECTED}, {address=dev-mongo3:27017, type=REPLICA_SET_SECONDARY, roundTripTime=4.4 ms, state=CONNECTED}, {address=dev-mongo4:27017, type=REPLICA_SET_SECONDARY, roundTripTime=1.4 ms, state=CONNECTED}]
启动服务器时本地环境输出
2016-10-13 16:38:11,696 main DEBUG Initializing configuration XmlConfiguration[location=/Users/justin/dev/company/company-server/target/classes/log4j2.xml]
2016-10-13 16:38:11,725 main DEBUG Installed script engines
2016-10-13 16:38:12,421 main DEBUG Oracle Nashorn Version: 1.8.0_102, Language: ECMAScript, Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript}
2016-10-13 16:38:12,421 main DEBUG PluginManager 'Core' found 101 plugins
2016-10-13 16:38:12,422 main DEBUG PluginManager 'Level' found 0 plugins
2016-10-13 16:38:12,429 main DEBUG No scheduled items
2016-10-13 16:38:12,431 main DEBUG Building Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
2016-10-13 16:38:12,448 main TRACE TypeConverterRegistry initializing.
2016-10-13 16:38:12,448 main DEBUG PluginManager 'TypeConverter' found 23 plugins
2016-10-13 16:38:12,468 main DEBUG createProperty(name="pattern", value="%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n")
2016-10-13 16:38:12,469 main DEBUG Building Plugin[name=properties, class=org.apache.logging.log4j.core.config.PropertiesPlugin].
2016-10-13 16:38:12,482 main DEBUG configureSubstitutor(={pattern=%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n}, Configuration(/Users/justin/dev/company/company-server/target/classes/log4j2.xml))
2016-10-13 16:38:12,482 main DEBUG PluginManager 'Lookup' found 13 plugins
2016-10-13 16:38:12,483 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
2016-10-13 16:38:12,494 main DEBUG PatternLayout$Builder(pattern="%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n", PatternSelector=null, Configuration(/Users/justin/dev/company/company-server/target/classes/log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null")
2016-10-13 16:38:12,494 main DEBUG PluginManager 'Converter' found 41 plugins
2016-10-13 16:38:12,514 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender].
2016-10-13 16:38:12,516 main INFO Log4j appears to be running in a Servlet environment, but there's no log4j-web module available. If you want better web container support, please add the log4j-web JAR to your web archive or server lib directory.
2016-10-13 16:38:12,517 main DEBUG PluginManager 'Converter' found 41 plugins
2016-10-13 16:38:12,518 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false-2
2016-10-13 16:38:12,527 main DEBUG ConsoleAppender$Builder(patternlayout(%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n), Filter=null, target="SYSTEM_OUT", name="console", follow="null", direct="null", ignoreExceptions="null")
2016-10-13 16:38:12,528 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false
2016-10-13 16:38:12,528 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
2016-10-13 16:38:12,530 main DEBUG PatternLayout$Builder(pattern="%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n", PatternSelector=null, Configuration(/Users/justin/dev/company/company-server/target/classes/log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null")
2016-10-13 16:38:12,530 main DEBUG Building Plugin[name=appender, class=com.getsentry.raven.log4j2.SentryAppender].
2016-10-13 16:38:12,534 main ERROR appender raven has no parameter that matches element patternlayout
2016-10-13 16:38:12,534 main DEBUG createAppender(name="sentry", dsn="https://229c49d166d34562b819422b438db969:808712a3940b4f838d47b148c57d884e@sentry.company2.com/2?options", ravenFactory="null", release="null", environment="null", serverName="null", tags="null", extraTags="null", filters=null)
2016-10-13 16:38:12,535 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
2016-10-13 16:38:12,535 main DEBUG PatternLayout$Builder(pattern="%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n", PatternSelector=null, Configuration(/Users/justin/dev/company/company-server/target/classes/log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null")
2016-10-13 16:38:12,536 main DEBUG Building Plugin[name=appender, class=com.logentries.log4j2.LogentriesAppender].
2016-10-13 16:38:12,538 main DEBUG createAppender(name="le", token="eb8056e2-f7df-4882-acb1-3048c7006643", key="null", location="null", httpPut="false", ssl="false", debug="false", useDataHub="false", dataHubAddr="null", dataHubPort="0", logHostName="false", hostName="null", logID="null", ignoreExceptions="false", patternlayout(%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n), Filters=null)
2016-10-13 16:38:12,540 main DEBUG Starting LogentriesManager le
2016-10-13 16:38:12,542 main DEBUG AsyncLogger created.
2016-10-13 16:38:12,543 main DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
2016-10-13 16:38:12,543 main DEBUG createAppenders(={console, sentry, le})
2016-10-13 16:38:12,543 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
2016-10-13 16:38:12,544 main DEBUG createAppenderRef(ref="le", level="null", Filter=null)
2016-10-13 16:38:12,544 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
2016-10-13 16:38:12,545 main DEBUG createAppenderRef(ref="sentry", level="null", Filter=null)
2016-10-13 16:38:12,545 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
2016-10-13 16:38:12,545 main DEBUG createAppenderRef(ref="console", level="null", Filter=null)
2016-10-13 16:38:12,546 main DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
2016-10-13 16:38:12,547 main DEBUG createLogger(additivity="null", level="DEBUG", includeLocation="null", ={le, sentry, console}, ={}, Configuration(/Users/justin/dev/company/company-server/target/classes/log4j2.xml), Filter=null)
2016-10-13 16:38:12,549 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
2016-10-13 16:38:12,550 main DEBUG createAppenderRef(ref="console", level="null", Filter=null)
2016-10-13 16:38:12,550 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig].
2016-10-13 16:38:12,552 main DEBUG createLogger(additivity="false", level="DEBUG", name="com.amazonaws", includeLocation="null", ={console}, ={}, Configuration(/Users/justin/dev/company/company-server/target/classes/log4j2.xml), Filter=null)
2016-10-13 16:38:12,552 main DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
2016-10-13 16:38:12,553 main DEBUG createLoggers(={root, com.amazonaws})
2016-10-13 16:38:12,554 main DEBUG Configuration XmlConfiguration[location=/Users/justin/dev/company/company-server/target/classes/log4j2.xml] initialized
2016-10-13 16:38:12,554 main DEBUG Starting configuration XmlConfiguration[location=/Users/justin/dev/company/company-server/target/classes/log4j2.xml]
2016-10-13 16:38:12,555 main DEBUG Started configuration XmlConfiguration[location=/Users/justin/dev/company/company-server/target/classes/log4j2.xml] OK.
2016-10-13 16:38:12,555 main TRACE Stopping org.apache.logging.log4j.core.config.DefaultConfiguration@7d0587f1...
2016-10-13 16:38:12,555 main TRACE DefaultConfiguration notified 1 ReliabilityStrategies that config will be stopped.
2016-10-13 16:38:12,556 main TRACE DefaultConfiguration stopping root LoggerConfig.
2016-10-13 16:38:12,556 main TRACE DefaultConfiguration notifying ReliabilityStrategies that appenders will be stopped.
2016-10-13 16:38:12,556 main TRACE DefaultConfiguration stopping remaining Appenders.
2016-10-13 16:38:12,556 main DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false.false-1
2016-10-13 16:38:12,556 main TRACE DefaultConfiguration stopped 1 remaining Appenders.
2016-10-13 16:38:12,557 main TRACE DefaultConfiguration cleaning Appenders from 1 LoggerConfigs.
2016-10-13 16:38:12,557 main DEBUG Stopped org.apache.logging.log4j.core.config.DefaultConfiguration@7d0587f1 OK
2016-10-13 16:38:12,628 main TRACE Reregistering MBeans after reconfigure. Selector=org.apache.logging.log4j.core.selector.ClassLoaderContextSelector@19c65cdc
2016-10-13 16:38:12,628 main TRACE Reregistering context (1/1): '18b4aac2' org.apache.logging.log4j.core.LoggerContext@74bf1791
2016-10-13 16:38:12,631 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2'
2016-10-13 16:38:12,631 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=StatusLogger'
2016-10-13 16:38:12,632 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=ContextSelector'
2016-10-13 16:38:12,632 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=Loggers,name=*'
2016-10-13 16:38:12,633 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=Appenders,name=*'
2016-10-13 16:38:12,633 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=AsyncAppenders,name=*'
2016-10-13 16:38:12,633 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=AsyncLoggerRingBuffer'
2016-10-13 16:38:12,634 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=Loggers,name=*,subtype=RingBuffer'
2016-10-13 16:38:12,637 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2
2016-10-13 16:38:12,640 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=StatusLogger
2016-10-13 16:38:12,641 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=ContextSelector
2016-10-13 16:38:12,643 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=Loggers,name=
2016-10-13 16:38:12,644 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=Loggers,name=com.amazonaws
2016-10-13 16:38:12,646 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=Appenders,name=console
2016-10-13 16:38:12,646 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=Appenders,name=le
2016-10-13 16:38:12,647 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=Appenders,name=sentry
2016-10-13 16:38:12,651 main TRACE Using default SystemClock for timestamps.
2016-10-13 16:38:12,652 main TRACE Using DummyNanoClock for nanosecond timestamps.
2016-10-13 16:38:12,653 main DEBUG Reconfiguration complete for context[name=18b4aac2] at URI /Users/justin/dev/company/company-server/target/classes/log4j2.xml (org.apache.logging.log4j.core.LoggerContext@74bf1791) with optional ClassLoader: null
2016-10-13 16:38:12,653 main DEBUG Shutdown hook enabled. Registering a new one.
2016-10-13 16:38:12,655 main DEBUG LoggerContext[name=18b4aac2, org.apache.logging.log4j.core.LoggerContext@74bf1791] started OK.
2016-10-13 16:38:12,679 main ERROR Recursive call to appender sentry
04:38:12.012 [mode=local] [main] DEBUG com.getsentry.raven.RavenFactory - Attempting to find a working Raven factory
2016-10-13 16:38:12,725 main ERROR Recursive call to appender sentry
04:38:12.012 [mode=local] [main] DEBUG com.getsentry.raven.RavenFactory - Attempting to use 'RavenFactory{name='com.getsentry.raven.DefaultRavenFactory'}' as a Raven factory.
2016-10-13 16:38:12,730 main ERROR Recursive call to appender sentry
04:38:12.012 [mode=local] [main] INFO com.getsentry.raven.DefaultRavenFactory - Using an HTTP connection to Sentry.
2016-10-13 16:38:12,866 main ERROR Recursive call to appender sentry
04:38:12.012 [mode=local] [main] DEBUG com.getsentry.raven.Raven - Adding 'com.getsentry.raven.event.helper.HttpEventBuilderHelper@74f5ce22' to the list of builder helpers.
04:38:12.012 [mode=local] [main] DEBUG com.getsentry.raven.Raven - Adding 'com.getsentry.raven.event.helper.ContextBuilderHelper@40238dd0' to the list of builder helpers.
04:38:12.012 [mode=local] [main] DEBUG com.getsentry.raven.RavenFactory - The raven factory 'RavenFactory{name='com.getsentry.raven.DefaultRavenFactory'}' created an instance of Raven.
04:38:12.012 [mode=local] [main] DEBUG com.getsentry.raven.event.EventBuilder$HostnameCache - Updating the hostname cache
04:38:12.012 [mode=local] [main] INFO com.company.server.companyServer - company-server starting
尝试 <Configuration packages="com.getsentry.raven.log4j2">
靠近 log4j2.xml
顶部的某个位置
(为了完整起见,Brett 在评论中回答了这个问题)
我正在尝试在 java 应用程序(这是一个网络 API)中设置一些第三方附加程序 - 附加程序是作为依赖项添加的库。这是一个 Maven 应用程序,这些库是 Raven(通过 Sentry)和 Logentries。他们接受日志并提供 GUI 来查看它们。
在本地一切正常 - 当 运行 整个应用程序的本地日志成功显示在 Logentries 和 Sentry 中时。在两种环境中都成功找到并解析了配置。下面包含我的 log4j2.xml
配置和为这两种环境启动服务器时的输出。
在暂存环境中,我看到日志显示 CLASS_NOT_FOUND
,所以这可能是 class 路径问题?有什么想法吗?
配置
<?xml version="1.0" encoding="utf-8"?>
<configuration status="all">
<properties>
<property name="pattern">%d{hh:mm:ss.sss} [mode=${env:MODE}] [%t] %-5level %logger{36} - %msg%n</property>
</properties>
<appenders>
<console name="console" target="system_out">
<patternlayout pattern="${pattern}"/>
</console>
<raven name="sentry">
<dsn>[dsn_here]</dsn>
<patternlayout pattern="${pattern}"/>
<!--to turn down the noise-->
<!--<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>-->
</raven>
<logentries name="le">
<token>[token_here]</token>
<patternlayout pattern="${pattern}"/>
<!--to turn down the noise-->
<!--<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>-->
</logentries>
</appenders>
<loggers>
<root level="debug">
<appender-ref ref="le"/>
<appender-ref ref="sentry"/>
<appender-ref ref="console"/>
</root>
<logger name="com.amazonaws" level="debug" additivity="false">
<appender-ref ref="console"/>
</logger>
</loggers>
</configuration>
启动服务器时的暂存环境输出
Oct 13 20:21:23 dev-company1 java: 2016-10-13 20:21:23,723 main DEBUG Initializing configuration XmlConfiguration[location=jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml]
Oct 13 20:21:23 dev-company1 java: 2016-10-13 20:21:23,729 main DEBUG Installed script engines
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,282 main DEBUG Oracle Nashorn Version: 1.8.0_101, Language: ECMAScript, Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript}
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,283 main DEBUG PluginManager 'Core' found 99 plugins
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,283 main DEBUG PluginManager 'Level' found 0 plugins
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,285 main ERROR Error processing element raven ([appenders: null]): CLASS_NOT_FOUND
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,286 main ERROR Error processing element logentries ([appenders: null]): CLASS_NOT_FOUND
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,288 main DEBUG No scheduled items
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,289 main DEBUG Building Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,303 main TRACE TypeConverterRegistry initializing.
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,303 main DEBUG PluginManager 'TypeConverter' found 23 plugins
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,317 main DEBUG createProperty(name="pattern", value="%d{hh:mm:ss.sss} [mode=dev] [%t] %-5level %logger{36} - %msg%n")
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,317 main DEBUG Building Plugin[name=properties, class=org.apache.logging.log4j.core.config.PropertiesPlugin].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,326 main DEBUG configureSubstitutor(={pattern=%d{hh:mm:ss.sss} [mode=dev] [%t] %-5level %logger{36} - %msg%n}, Configuration(jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml))
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,327 main DEBUG PluginManager 'Lookup' found 13 plugins
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,328 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,332 main DEBUG PatternLayout$Builder(pattern="%d{hh:mm:ss.sss} [mode=dev] [%t] %-5level %logger{36} - %msg%n", PatternSelector=null, Configuration(jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null")
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,332 main DEBUG PluginManager 'Converter' found 41 plugins
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,366 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,367 main DEBUG PluginManager 'Converter' found 41 plugins
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,367 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false-2
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,381 main DEBUG ConsoleAppender$Builder(patternlayout(%d{hh:mm:ss.sss} [mode=dev] [%t] %-5level %logger{36} - %msg%n), Filter=null, target="SYSTEM_OUT", name="console", follow="null", direct="null", ignoreExceptions="null")
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,381 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,381 main DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,382 main DEBUG createAppenders(={console})
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,382 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,383 main DEBUG createAppenderRef(ref="le", level="null", Filter=null)
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,383 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,383 main DEBUG createAppenderRef(ref="sentry", level="null", Filter=null)
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,383 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,384 main DEBUG createAppenderRef(ref="console", level="null", Filter=null)
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,384 main DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,385 main DEBUG createLogger(additivity="null", level="DEBUG", includeLocation="null", ={le, sentry, console}, ={}, Configuration(jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml), Filter=null)
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,386 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,387 main DEBUG createAppenderRef(ref="console", level="null", Filter=null)
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,387 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,390 main DEBUG createLogger(additivity="false", level="DEBUG", name="com.amazonaws", includeLocation="null", ={console}, ={}, Configuration(jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml), Filter=null)
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,391 main DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,401 main DEBUG createLoggers(={root, com.amazonaws})
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,401 main ERROR Unable to locate appender "le" for logger config "root"
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,401 main ERROR Unable to locate appender "sentry" for logger config "root"
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,402 main DEBUG Configuration XmlConfiguration[location=jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml] initialized
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,402 main DEBUG Starting configuration XmlConfiguration[location=jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml]
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,402 main DEBUG Started configuration XmlConfiguration[location=jar:file:/home/company-dev/app/current/company-server.jar!/log4j2.xml] OK.
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,403 main TRACE Stopping org.apache.logging.log4j.core.config.DefaultConfiguration@531d72ca...
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,403 main TRACE DefaultConfiguration notified 1 ReliabilityStrategies that config will be stopped.
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,403 main TRACE DefaultConfiguration stopping root LoggerConfig.
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,404 main TRACE DefaultConfiguration notifying ReliabilityStrategies that appenders will be stopped.
Oct 13 20:21:24 dev-company1 java: 2016-10-13 20:21:24,404 main TRACE DefaultConfiguration stopping remaining Appenders.
Oct 13 20:21:45 dev-company1 journal: Suppressed 692 messages from /system.slice/company.service
Oct 13 20:21:45 dev-company1 java: 08:21:45.045 [mode=dev] [cluster-ClusterId{value='57ffecc465bab830ccd6f372', description='null'}-dev-mongo2:27017] DEBUG org.mongodb.driver.cluster - Checking status of dev-mongo2:27017
Oct 13 20:21:45 dev-company1 java: 08:21:45.045 [mode=dev] [cluster-ClusterId{value='57ffecc465bab830ccd6f372', description='null'}-dev-mongo2:27017] DEBUG org.mongodb.driver.cluster - Updating cluster description to {type=REPLICA_SET, servers=[{address=dev-mongo2:27017, type=REPLICA_SET_PRIMARY, roundTripTime=9.2 ms, state=CONNECTED}, {address=dev-mongo3:27017, type=REPLICA_SET_SECONDARY, roundTripTime=4.4 ms, state=CONNECTED}, {address=dev-mongo4:27017, type=REPLICA_SET_SECONDARY, roundTripTime=1.4 ms, state=CONNECTED}]
启动服务器时本地环境输出
2016-10-13 16:38:11,696 main DEBUG Initializing configuration XmlConfiguration[location=/Users/justin/dev/company/company-server/target/classes/log4j2.xml]
2016-10-13 16:38:11,725 main DEBUG Installed script engines
2016-10-13 16:38:12,421 main DEBUG Oracle Nashorn Version: 1.8.0_102, Language: ECMAScript, Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript}
2016-10-13 16:38:12,421 main DEBUG PluginManager 'Core' found 101 plugins
2016-10-13 16:38:12,422 main DEBUG PluginManager 'Level' found 0 plugins
2016-10-13 16:38:12,429 main DEBUG No scheduled items
2016-10-13 16:38:12,431 main DEBUG Building Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
2016-10-13 16:38:12,448 main TRACE TypeConverterRegistry initializing.
2016-10-13 16:38:12,448 main DEBUG PluginManager 'TypeConverter' found 23 plugins
2016-10-13 16:38:12,468 main DEBUG createProperty(name="pattern", value="%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n")
2016-10-13 16:38:12,469 main DEBUG Building Plugin[name=properties, class=org.apache.logging.log4j.core.config.PropertiesPlugin].
2016-10-13 16:38:12,482 main DEBUG configureSubstitutor(={pattern=%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n}, Configuration(/Users/justin/dev/company/company-server/target/classes/log4j2.xml))
2016-10-13 16:38:12,482 main DEBUG PluginManager 'Lookup' found 13 plugins
2016-10-13 16:38:12,483 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
2016-10-13 16:38:12,494 main DEBUG PatternLayout$Builder(pattern="%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n", PatternSelector=null, Configuration(/Users/justin/dev/company/company-server/target/classes/log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null")
2016-10-13 16:38:12,494 main DEBUG PluginManager 'Converter' found 41 plugins
2016-10-13 16:38:12,514 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender].
2016-10-13 16:38:12,516 main INFO Log4j appears to be running in a Servlet environment, but there's no log4j-web module available. If you want better web container support, please add the log4j-web JAR to your web archive or server lib directory.
2016-10-13 16:38:12,517 main DEBUG PluginManager 'Converter' found 41 plugins
2016-10-13 16:38:12,518 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false-2
2016-10-13 16:38:12,527 main DEBUG ConsoleAppender$Builder(patternlayout(%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n), Filter=null, target="SYSTEM_OUT", name="console", follow="null", direct="null", ignoreExceptions="null")
2016-10-13 16:38:12,528 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false
2016-10-13 16:38:12,528 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
2016-10-13 16:38:12,530 main DEBUG PatternLayout$Builder(pattern="%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n", PatternSelector=null, Configuration(/Users/justin/dev/company/company-server/target/classes/log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null")
2016-10-13 16:38:12,530 main DEBUG Building Plugin[name=appender, class=com.getsentry.raven.log4j2.SentryAppender].
2016-10-13 16:38:12,534 main ERROR appender raven has no parameter that matches element patternlayout
2016-10-13 16:38:12,534 main DEBUG createAppender(name="sentry", dsn="https://229c49d166d34562b819422b438db969:808712a3940b4f838d47b148c57d884e@sentry.company2.com/2?options", ravenFactory="null", release="null", environment="null", serverName="null", tags="null", extraTags="null", filters=null)
2016-10-13 16:38:12,535 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
2016-10-13 16:38:12,535 main DEBUG PatternLayout$Builder(pattern="%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n", PatternSelector=null, Configuration(/Users/justin/dev/company/company-server/target/classes/log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null")
2016-10-13 16:38:12,536 main DEBUG Building Plugin[name=appender, class=com.logentries.log4j2.LogentriesAppender].
2016-10-13 16:38:12,538 main DEBUG createAppender(name="le", token="eb8056e2-f7df-4882-acb1-3048c7006643", key="null", location="null", httpPut="false", ssl="false", debug="false", useDataHub="false", dataHubAddr="null", dataHubPort="0", logHostName="false", hostName="null", logID="null", ignoreExceptions="false", patternlayout(%d{hh:mm:ss.sss} [mode=local] [%t] %-5level %logger{36} - %msg%n), Filters=null)
2016-10-13 16:38:12,540 main DEBUG Starting LogentriesManager le
2016-10-13 16:38:12,542 main DEBUG AsyncLogger created.
2016-10-13 16:38:12,543 main DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
2016-10-13 16:38:12,543 main DEBUG createAppenders(={console, sentry, le})
2016-10-13 16:38:12,543 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
2016-10-13 16:38:12,544 main DEBUG createAppenderRef(ref="le", level="null", Filter=null)
2016-10-13 16:38:12,544 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
2016-10-13 16:38:12,545 main DEBUG createAppenderRef(ref="sentry", level="null", Filter=null)
2016-10-13 16:38:12,545 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
2016-10-13 16:38:12,545 main DEBUG createAppenderRef(ref="console", level="null", Filter=null)
2016-10-13 16:38:12,546 main DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
2016-10-13 16:38:12,547 main DEBUG createLogger(additivity="null", level="DEBUG", includeLocation="null", ={le, sentry, console}, ={}, Configuration(/Users/justin/dev/company/company-server/target/classes/log4j2.xml), Filter=null)
2016-10-13 16:38:12,549 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
2016-10-13 16:38:12,550 main DEBUG createAppenderRef(ref="console", level="null", Filter=null)
2016-10-13 16:38:12,550 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig].
2016-10-13 16:38:12,552 main DEBUG createLogger(additivity="false", level="DEBUG", name="com.amazonaws", includeLocation="null", ={console}, ={}, Configuration(/Users/justin/dev/company/company-server/target/classes/log4j2.xml), Filter=null)
2016-10-13 16:38:12,552 main DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
2016-10-13 16:38:12,553 main DEBUG createLoggers(={root, com.amazonaws})
2016-10-13 16:38:12,554 main DEBUG Configuration XmlConfiguration[location=/Users/justin/dev/company/company-server/target/classes/log4j2.xml] initialized
2016-10-13 16:38:12,554 main DEBUG Starting configuration XmlConfiguration[location=/Users/justin/dev/company/company-server/target/classes/log4j2.xml]
2016-10-13 16:38:12,555 main DEBUG Started configuration XmlConfiguration[location=/Users/justin/dev/company/company-server/target/classes/log4j2.xml] OK.
2016-10-13 16:38:12,555 main TRACE Stopping org.apache.logging.log4j.core.config.DefaultConfiguration@7d0587f1...
2016-10-13 16:38:12,555 main TRACE DefaultConfiguration notified 1 ReliabilityStrategies that config will be stopped.
2016-10-13 16:38:12,556 main TRACE DefaultConfiguration stopping root LoggerConfig.
2016-10-13 16:38:12,556 main TRACE DefaultConfiguration notifying ReliabilityStrategies that appenders will be stopped.
2016-10-13 16:38:12,556 main TRACE DefaultConfiguration stopping remaining Appenders.
2016-10-13 16:38:12,556 main DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false.false-1
2016-10-13 16:38:12,556 main TRACE DefaultConfiguration stopped 1 remaining Appenders.
2016-10-13 16:38:12,557 main TRACE DefaultConfiguration cleaning Appenders from 1 LoggerConfigs.
2016-10-13 16:38:12,557 main DEBUG Stopped org.apache.logging.log4j.core.config.DefaultConfiguration@7d0587f1 OK
2016-10-13 16:38:12,628 main TRACE Reregistering MBeans after reconfigure. Selector=org.apache.logging.log4j.core.selector.ClassLoaderContextSelector@19c65cdc
2016-10-13 16:38:12,628 main TRACE Reregistering context (1/1): '18b4aac2' org.apache.logging.log4j.core.LoggerContext@74bf1791
2016-10-13 16:38:12,631 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2'
2016-10-13 16:38:12,631 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=StatusLogger'
2016-10-13 16:38:12,632 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=ContextSelector'
2016-10-13 16:38:12,632 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=Loggers,name=*'
2016-10-13 16:38:12,633 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=Appenders,name=*'
2016-10-13 16:38:12,633 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=AsyncAppenders,name=*'
2016-10-13 16:38:12,633 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=AsyncLoggerRingBuffer'
2016-10-13 16:38:12,634 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=18b4aac2,component=Loggers,name=*,subtype=RingBuffer'
2016-10-13 16:38:12,637 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2
2016-10-13 16:38:12,640 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=StatusLogger
2016-10-13 16:38:12,641 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=ContextSelector
2016-10-13 16:38:12,643 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=Loggers,name=
2016-10-13 16:38:12,644 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=Loggers,name=com.amazonaws
2016-10-13 16:38:12,646 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=Appenders,name=console
2016-10-13 16:38:12,646 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=Appenders,name=le
2016-10-13 16:38:12,647 main DEBUG Registering MBean org.apache.logging.log4j2:type=18b4aac2,component=Appenders,name=sentry
2016-10-13 16:38:12,651 main TRACE Using default SystemClock for timestamps.
2016-10-13 16:38:12,652 main TRACE Using DummyNanoClock for nanosecond timestamps.
2016-10-13 16:38:12,653 main DEBUG Reconfiguration complete for context[name=18b4aac2] at URI /Users/justin/dev/company/company-server/target/classes/log4j2.xml (org.apache.logging.log4j.core.LoggerContext@74bf1791) with optional ClassLoader: null
2016-10-13 16:38:12,653 main DEBUG Shutdown hook enabled. Registering a new one.
2016-10-13 16:38:12,655 main DEBUG LoggerContext[name=18b4aac2, org.apache.logging.log4j.core.LoggerContext@74bf1791] started OK.
2016-10-13 16:38:12,679 main ERROR Recursive call to appender sentry
04:38:12.012 [mode=local] [main] DEBUG com.getsentry.raven.RavenFactory - Attempting to find a working Raven factory
2016-10-13 16:38:12,725 main ERROR Recursive call to appender sentry
04:38:12.012 [mode=local] [main] DEBUG com.getsentry.raven.RavenFactory - Attempting to use 'RavenFactory{name='com.getsentry.raven.DefaultRavenFactory'}' as a Raven factory.
2016-10-13 16:38:12,730 main ERROR Recursive call to appender sentry
04:38:12.012 [mode=local] [main] INFO com.getsentry.raven.DefaultRavenFactory - Using an HTTP connection to Sentry.
2016-10-13 16:38:12,866 main ERROR Recursive call to appender sentry
04:38:12.012 [mode=local] [main] DEBUG com.getsentry.raven.Raven - Adding 'com.getsentry.raven.event.helper.HttpEventBuilderHelper@74f5ce22' to the list of builder helpers.
04:38:12.012 [mode=local] [main] DEBUG com.getsentry.raven.Raven - Adding 'com.getsentry.raven.event.helper.ContextBuilderHelper@40238dd0' to the list of builder helpers.
04:38:12.012 [mode=local] [main] DEBUG com.getsentry.raven.RavenFactory - The raven factory 'RavenFactory{name='com.getsentry.raven.DefaultRavenFactory'}' created an instance of Raven.
04:38:12.012 [mode=local] [main] DEBUG com.getsentry.raven.event.EventBuilder$HostnameCache - Updating the hostname cache
04:38:12.012 [mode=local] [main] INFO com.company.server.companyServer - company-server starting
尝试 <Configuration packages="com.getsentry.raven.log4j2">
靠近 log4j2.xml
(为了完整起见,Brett 在评论中回答了这个问题)