AppHarbor LogEntries Integration Not Working
With the exact same code, build configuration and profile, our app does not log to logentries.
I'm really not sure how to troubleshoot this further (or provide additional information).
The logs appear in logentries when running locally, and do not when running deployed on AppHarbor.
Thanks in advance.
Discussions are closed to public comments.
If you need help with AppHarbor please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by rune on May 26, 2014 @ 11:40 PM
Hi,
What application are you experiencing this issue with? Logging with Logentries appears to be working fine on
cabwithmeorchard
, and thecabwithme
doesn't have Logentries installed (or logging enabled for that matter).Best,
Rune
2 Posted by CabWithMe on May 27, 2014 @ 03:12 AM
CabWithMe.Orchard.. I see logentries, but not the ones I'm logging. I guess the exception (I see HTTP 500 coming back) isn't caught and logged by the global exception handler for WebAPI which I'm registering like this.
I can't reproduce the exception at all locally.
Any ideas?
Support Staff 3 Posted by rune on May 27, 2014 @ 03:35 AM
Ok, what does the "TraceExceptionFilter" do? Have you set this up to post directly to Logentries?
Best,
Rune
4 Posted by CabWithMe on May 27, 2014 @ 05:01 AM
public class TraceExceptionFilter : IExceptionFilter { public bool AllowMultiple { get; private set; } public Task ExecuteExceptionFilterAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken) { return Task.Factory.StartNew(() => CwmTraceSource.Instance.TraceEvent(TraceEventType.Error, actionExecutedContext.Exception.HResult, actionExecutedContext.Exception.ToString()), cancellationToken); }
and CwmTraceSource has listeners:
<system.diagnostics> <trace autoflush="true"> </trace> <sources> <source name="Cwm" switchName="SourceSwitch" switchType="System.Diagnostics.SourceSwitch"> <listeners> <add name="log4net" type="Cwm.Infrastructure.Logging.Log4NetTraceListener, Cwm.Core"></add> </listeners> </source> </sources> <switches> <add name="SourceSwitch" value="All" /> </switches> </system.diagnostics>
and log4net config has
<?xml version="1.0" encoding="utf-8"?> <log4net> <root> <!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF --> <priority value="ALL" /> <level value="ALL" /> <appender-ref ref="LeAppender" /> </root> <appender name="LeAppender" type="log4net.Appender.LogentriesAppender, LogentriesLog4net"> <immediateFlush value="true" /> <debug value="true" /> <useHttpPut value="false" /> <useSsl value="false" /> <layout type="log4net.Layout.PatternLayout"> <!-- The below pattern has been carefully formatted and optimized to work well with the Logentries.com entry parser. For reference see https://logentries.com/doc/search/. --> <param name="ConversionPattern" value="%d %logger %level% %m%n" /> </layout> </appender> </log4net>
finally` public class Log4NetTraceListener : TraceListener { public override void Fail(string message) { Fail(message, string.Empty); }
`
Basically I don't want to take a dependency on log4net, but there is existing integration build from log4net to logentries which I'd like to leverage. This all works dandy locally
Support Staff 5 Posted by rune on May 27, 2014 @ 05:06 AM
Ok - the functionality here seems pretty much identical to the stuff you can already use with AppHarbor. Have you tried using the approach I linked to in the other thread?
When you see the logs/trace messages in the online log viewer under your application you'll be able to forward those to Logentries automatically.
Best,
Rune