<PackageReference Include="NLog" Version="6.0.7" />

NLog.LogManager

public static class LogManager
Creates and manages instances of Logger objects.
public static bool AutoShutdown { get; set; }

Gets or sets a value indicating whether to automatically call Shutdown on AppDomain.Unload or AppDomain.ProcessExit

public static LoggingConfiguration Configuration { get; set; }

Gets or sets the current logging configuration.

public static LogLevel GlobalThreshold { get; set; }

Gets or sets the global log threshold. Log events below this threshold are not logged.

public static bool KeepVariablesOnReload { get; set; }

Gets or sets a value indicating whether Variables should be kept on configuration reload.

public static LogFactory LogFactory { get; }

Gets the LogFactory instance used in the LogManager.

public static bool? ThrowConfigExceptions { get; set; }

Gets or sets a value indicating whether NLogConfigurationException should be thrown.

public static bool ThrowExceptions { get; set; }

Gets or sets a value indicating whether NLog should throw exceptions. By default exceptions are not thrown under any circumstances.

Occurs when logging Configuration changes. Both when assigned to new config or config unloaded.

public static void AddHiddenAssembly(Assembly assembly)

Adds the given assembly which will be skipped when NLog is trying to find the calling method on stack trace.

public static Logger CreateNullLogger()

Creates a logger that discards all log messages.

public static IDisposable DisableLogging()

Obsolete and replaced by by SuspendLogging with NLog v5. Suspends the logging, and returns object for using-scope so scope-exit calls EnableLogging

public static void EnableLogging()

Obsolete and replaced by disposing the scope returned from SuspendLogging with NLog v5. Resumes logging if having called DisableLogging.

public static void Flush()

Flush any pending log messages (in case of asynchronous targets) with the default timeout of 15 seconds.

public static void Flush(TimeSpan timeout)

Flush any pending log messages (in case of asynchronous targets).

public static void Flush(int timeoutMilliseconds)

Flush any pending log messages (in case of asynchronous targets).

public static void Flush(AsyncContinuation asyncContinuation)

Flush any pending log messages (in case of asynchronous targets).

public static void Flush(AsyncContinuation asyncContinuation, TimeSpan timeout)

Flush any pending log messages (in case of asynchronous targets).

public static void Flush(AsyncContinuation asyncContinuation, int timeoutMilliseconds)

Flush any pending log messages (in case of asynchronous targets).

public static Logger GetCurrentClassLogger()

Gets the logger with the full name of the current class, so namespace and class name.

public static Logger GetCurrentClassLogger(Type loggerType)

Obsolete and replaced by GetCurrentClassLogger<T> with NLog v5.2. Gets a custom logger with the full name of the current class, so namespace and class name. Use loggerType to create instance of a custom Logger. If you haven't defined your own Logger class, then use the overload without the loggerType.

public static Logger GetLogger(string name)

Gets the specified named logger.

public static Logger GetLogger(string name, Type loggerType)

Obsolete and replaced by GetLogger<T> with NLog v5.2. Gets the specified named custom Logger using the parameter loggerType for creating instance. If you haven't defined your own Logger class, then use the overload without the loggerType.

public static bool IsLoggingEnabled()

Returns true if logging is currently enabled.

public static LogFactory LoadConfiguration(string configFile)

Obsolete and replaced by Setup and LoadConfigurationFromFile with NLog v5.2. Loads logging configuration from file (Only XML configuration files supported)

public static void ReconfigExistingLoggers()

Loops through all loggers previously returned by GetLogger. and recalculates their target and filter list. Useful after modifying the configuration programmatically to ensure that all loggers have been properly configured.

public static void ReconfigExistingLoggers(bool purgeObsoleteLoggers)

Loops through all loggers previously returned by GetLogger. and recalculates their target and filter list. Useful after modifying the configuration programmatically to ensure that all loggers have been properly configured.

public static void ResumeLogging()

Resumes logging if having called SuspendLogging.

public static ISetupBuilder Setup()

Begins configuration of the LogFactory options using fluent interface

public static LogFactory Setup(Action<ISetupBuilder> setupBuilder)

Begins configuration of the LogFactory options using fluent interface

public static void Shutdown()

Dispose all targets, and shutdown logging.

public static IDisposable SuspendLogging()

Suspends the logging, and returns object for using-scope so scope-exit calls ResumeLogging