Skip to content

Commit bc29626

Browse files
committed
Add ability to set the min log level in configuration
1 parent f1a1428 commit bc29626

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Exceptionless/Configuration/ExceptionlessConfiguration.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,15 @@ public TimeSpan? UpdateSettingsWhenIdleInterval {
178178
}
179179
}
180180

181+
/// <summary>
182+
/// Set the default minimum log level that will be used until settings are loaded from the server.
183+
/// </summary>
184+
/// <param name="minLogLevel"></param>
185+
public void SetDefaultMinLogLevel(LogLevel minLogLevel) {
186+
if (!Settings.ContainsKey("@@log:*"))
187+
Settings.Add("@@log:*", minLogLevel.ToString());
188+
}
189+
181190
/// <summary>
182191
/// Gets or sets a value indicating whether to include private information about the local machine.
183192
/// </summary>

src/Platforms/Exceptionless.NLog/readme.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ and viewing your project configuration page.
1919
-------------------------------------
2020

2121
Here is an example NLog.config file that shows how to use the Exceptionless NLog target. The apiKey attribute
22-
is optional and will be picked up from your Exceptionless config section by default.
22+
is optional and will be picked up from your Exceptionless config section by default. It is recommended to set
23+
the minLevel on the Exceptionless target to Trace so that you can control log levels in the server side
24+
client configuration settings. Also, you can call Configuration.SetDefaultMinLogLevel to control the default
25+
minimum log level that will be used until the client retrieves settings from the server.
2326

2427
<nlog>
2528
<extensions>
@@ -36,7 +39,7 @@ is optional and will be picked up from your Exceptionless config section by defa
3639
  </targets>
3740

3841
  <rules>
39-
    <logger name="*" minlevel="Info" writeTo="exceptionless" />
42+
    <logger name="*" minlevel="Trace" writeTo="exceptionless" />
4043
  </rules>
4144
</nlog>
4245

0 commit comments

Comments
 (0)