100 Blogs achievement :)
Note that I found the latest elasticsearch.yml
of Exceptionless (3.1.1822) won’t work fine on the
latest version : 2.1.0, of elasticsearch.
But it was ok with elasticsearch 1.7.2 !
The error
message on elasticsearch 2.1.0 … (looks like some conflict issues.)
|
service.bat install
[Service Id]
|
<add
name="ElasticSearchConnectionString" connectionString="http://localhost:9200"
/>
|
<add
key="BaseURL" value="http://localhost:5100/#" />
|
<add
key="EnableSSL" value="false" />
|
<add
key="WebsiteMode" value="Dev" />
|
<add
key="Exceptionless:ServerUrl" value="http://localhost:5000" />
|
'BASE_URL',
'http://localhost:5100'
|
'USE_HTML5_MODE',
false
|
'USE_SSL', false
|
'BASE_URL',
'http://localhost:5100'
|
'USE_HTML5_MODE',
false
|
'USE_SSL', false
|
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="exceptionless" type="Exceptionless.ExceptionlessSection,
Exceptionless.Extras" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<exceptionless apiKey="XXXX" enableLogging="true" logPath="C:\temp\exceptionless.log" />
</configuration>
|
var client = new ExceptionlessClient(config => {
// Set your API key. (Optional if
the config is set)
config.ApiKey = "XXXXXX";
// Exceptionless server.
config.ServerUrl = "http://localhost:5100/";
// Read config settings from attributes.
config.ReadFromAttributes();
// Exclude any form fields,
cookies, query string parameters, and custom data properties containing
"CompanyPrivate".
//config.AddDataExclusions("CompanyPrivate");
// Add the "SomeTag" to
all events.
config.DefaultTags.Add("Test");
// Add the "MyObject" custom data object to every
event.
//config.DefaultData.Add("MyObject", new {
MyProperty = "Value1" });
// Register a custom log implementation that uses NLog.
//config.Resolver.Register<IExceptionlessLog>(new
NLogExceptionlessLog());
});
client.Register();
|
// Submit logs
client.SubmitLog("Logging made
easy");
// You can also
specify the log source and log level.
// We recommend
specifying one of the following log levels: Trace, Debug, Info, Warn, Error
client.SubmitLog(typeof(Program).FullName, "This is so
easy", "Info");
client.CreateLog(typeof(Program).FullName, "This is so
easy", "Info").AddTags("Exceptionless").Submit();
// Submit feature
usages
client.SubmitFeatureUsage("MyFeature");
client.CreateFeatureUsage("MyFeature").AddTags("Exceptionless").Submit();
// Submit a 404
client.SubmitNotFound("/somepage");
client.CreateNotFound("/somepage").AddTags("Exceptionless").Submit();
// Submit a custom
event type
client.SubmitEvent(new Event { Message = "Low
Fuel", Type
= "racecar", Source = "Fuel
System" });
try
{ throw new ApplicationException(Guid.NewGuid().ToString()); }
catch (Exception ex)
{ ex.ToExceptionless(client:client).Submit(); }
|
<extensions>
<add assembly="Exceptionless.NLog" />
</extensions>
<targets>
<target name="Exceptionless" xsi:type="Exceptionless" apiKey="XXXXXX" serverUrl="http://localhost:5100/">
<field name="host" layout="${machinename}" />
<field name="identity" layout="${identity}" />
<field name="windows-identity" layout="${windows-identity:userName=True:domain=False}" />
<field name="process" layout="${processname}" />
</target>
</targets>
<rules>
<logger name="*" levels="Trace, Debug, Info, Warn, Error,
Fatal" writeTo="Exceptionless" />
</rules>
|