06-12-2013 06:48 PM
EDIT: At Julien Carsique's request I'll explain what I did to get Sentry logging working. We use Puppet for creating configuration files rather than Nuxeo templates, but the edits are so straightforward that it doesn't matter how it's done.
<appender name="SENTRY" class="net.kencochrane.raven.log4j.SentryAppender">
<param name="dsn" value="https://this-is-your-sentry-dsn-value-paste-it-in-exactly:1234/3"/>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="WARN"/>
</filter>
</appender>
<root>
<level value="WARN" />
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
<appender-ref ref="SENTRY" />
</root>
My trouble below was caused by an invalid DSN -- it didn't even resolve in DNS.
ORIGINAL QUESTION (fixed it myself):
I would like to use the raven-java Log4J appender to log notable events to a Sentry event console. I tried the simplest thing which could possibly work, which is to deploy the raven jars and their dependencies into Nuxeo's server/lib
directory, and edit the log4j.xml
to add a new appender. I receive the following error on startup:
2013-06-12 20:37:41,062 ERROR [org.nuxeo.runtime.tomcat.NuxeoLauncher] Failed to handle event
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.nuxeo.osgi.application.FrameworkBootstrap.start(FrameworkBootstrap.java:135)
at org.nuxeo.runtime.tomcat.NuxeoLauncher.handleEvent(NuxeoLauncher.java:117)
at org.nuxeo.runtime.tomcat.NuxeoLauncher.lifecycleEvent(NuxeoLauncher.java:88)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4700)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NullPointerException
at net.kencochrane.raven.log4j.SentryAppender.buildEvent(SentryAppender.java:125)
at net.kencochrane.raven.log4j.SentryAppender.append(SentryAppender.java:89)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
at org.apache.log4j.Category.callAppenders(Category.java:206)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.log(Category.java:856)
at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:193)
at org.nuxeo.osgi.application.loader.FrameworkLoader.printStartMessage(FrameworkLoader.java:379)
at org.nuxeo.osgi.application.loader.FrameworkLoader.doStart(FrameworkLoader.java:204)
at org.nuxeo.osgi.application.loader.FrameworkLoader.start(FrameworkLoader.java:112)
... 31 more
This error is interesting because it seems to indicate that the new classes and configurations are available, but that something in the way Nuxeo starts within Tomcat makes the state of the Raven logging system invalid.
Is there something general I am missing about using third-party log4j appenders with Nuxeo/Tomcat, or is this problem specific to Raven?
06-12-2013 07:09 PM
In order to answer my own question, this was caused by incorrect configuration of the Raven appender. This error apparently occurred before the appender of server.log was initialized. I wonder how to detect this class of error in general, since there was no indication of anything wrong in any of the Nuxeo-documented logs.
06-12-2013 07:09 PM
In order to answer my own question, this was caused by incorrect configuration of the Raven appender. This error apparently occurred before the appender of server.log was initialized. I wonder how to detect this class of error in general, since there was no indication of anything wrong in any of the Nuxeo-documented logs.
06-13-2013 12:40 AM
You mean there were unlogged errors? Maybe starting the server in console
would show them? Did you look into the other log files?
06-13-2013 12:43 AM
Would you mind contribute or document a Raven Log4J configuration template? Regards.
06-13-2013 11:35 AM
I looked in all the log files and didn't see anything. I assume that the error message complains about a bad initialization value in log4j.xml for the Sentry appender.
06-13-2013 01:42 PM
Strange you don't get an error, I'll try to reproduce it.
06-13-2013 06:06 PM
I added step-by-step instructions to the question above for now.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.