Logentries Docs

Find comprehensive guides and documentation to help you start and continue to work with Logentries.

    

Search results for "{{ search.query }}"

No results found for "{{search.query}}".
View All Results

AppHarbor

AppHarbor is a .NET Platform-as-a-Service. It makes deployment of .NET application easier and more fluent than before.

Activate the Logentries add-on

Go to the AppHarbor add-on page and activate the Logentries add-on.

Setup Your Library

Log4Net or NLog

In order to send your AppHarbor logs to your Logentries account you need to configure one of our supported libraries with your application: Log4Net and NLog

If you do not have NLog or Log4Net set up in your project, our plug-in NuGets below will install it for you. If you do have one of the libraries already installed our NuGets will update them appropriately with the Logentries specific dlls. Note, if you would prefer not to use NuGet and would like to install our NLog or Log4Net plug-in manually, you can visit our github page for further instructions.
Setup the Logentries NLog Plug-in le_nlog
Download

NLog Setup

Use NuGet to install the logentries.nlog Nuget package.
Configure

To configure NLog and our plug-in, paste the following into your Web/App.config directly underneath the opening:

<configuration>.
<configSections>
  <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</configSections>
<nlog>
  <extensions>
    <add assembly="LogentriesNLog"/>
  </extensions>
  <targets>
    <target name="logentries" type="Logentries" debug="true"
    layout="${date:format=ddd MMM dd} ${time:format=HH:mm:ss} ${date:format=zzz yyyy} ${logger} : ${LEVEL}, ${message}"/>
  </targets>
  <rules>
    <logger name="*" minLevel="Debug" appendTo="logentries"/>
  </rules>
</nlog>

In each class you wish to log from, enter the following using directives at the top if not already there:

using NLog;

Then create an instance of the Logger class at class-level:

private static Logger logger = LogManager.GetCurrentClassLogger();

This creates a logger with the name of the current class, which will be logged with each log event. This allows you to identify log events from different classes. Now you can log using NLog as normal within the class and it will log to Logentries.

Log4Net Setup

Use NuGet to install the logentries.log4net Nuget package.

First, paste the following into your Web/App.config directly underneath the opening <configuration>to configure Log4Net and our plug-in.

<configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
  <appender name="LeAppender" type="log4net.Appender.LogentriesAppender, LogentriesLog4net">
    <Debug value="true" />
    <layout type="log4net.Layout.PatternLayout">
      <param name="ConversionPattern" value="%d{ddd MMM dd HH:mm:ss zzz yyyy} %logger %: %level%, %m" />
    </layout>
  </appender>
  <root>
    <level value="ALL" />
    <appender-ref ref="LeAppender" />
  </root>
</log4net>

Next you need to place the following line in your AssemblyInfo.cs file:
[assembly: log4net.Config.XmlConfigurator(ConfigFile="Web.config", Watch = true)]

In each class you wish to log from, enter the following using directives at the top if not already there:

using log4net;

Then create an instance of the Logger class at class-level:
private static readonly ILog logger = LogManager.GetLogger( typeof(name_of_class));
This creates a logger with the name of the current class, which will be logged with each log event. This allows you to identify log events from different classes. Now you can log using Log4Net as normal within the class and it will log to Logentries.

Run your application on AppHarbor and log some events. Then click Go To Logentries in the AppHarbor UI. This will bring you to the Logentries user interface where you will see your log entries. AppHarbor Log Monitoring

AppHarbor