DigitalData.Modules.Logging
Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
LogConfig
0.0.1.0
02.10.2018
Module that writes file-logs to different locations:
local application data, the current directory or a custom path.
Files and directories will be automatically created.
NLog, >= 4.5.8
Imports DigitalData.Modules.Logging
Class FooProgram
Private Logger as Logger
Private LogConfig as LogConfig
Public Sub New()
LogConfig = new LogConfig(args)
Logger = LogConfig.GetLogger()
End Sub
Public Sub Bar()
Logger.Info("Baz")
End Sub
End Class
Class FooLib
Private Logger as NLog.Logger
Public Sub New(LogConfig as LogConfig)
Logger = LogConfig.GetLogger()
End Sub
Public Sub Bar()
Logger.Info("Baz")
End Sub
End Class
If logpath can not be written to, falls back to temp folder as defined in:
https://docs.microsoft.com/de-de/dotnet/api/system.io.path.gettemppath?view=netframework-4.7.2
If used in a service, LogPath must be set to CustomPath, otherwise the Log will be written to System32!
For NLog Troubleshooting, set the following Environment variables to write the NLog internal Log:
- NLOG_INTERNAL_LOG_LEVEL: Debug
- NLOG_INTERNAL_LOG_FILE: ex. C:\Temp\Nlog_Internal.log
Returns the NLog.LogFactory object that is used to create Loggers
LogFactory object
Returns the path to the current default logfile
Filepath to the logfile
Returns the path to the current log directory
Directory path to the log directory
Determines if a debug log will be written
True, if debug log will be written. False otherwise.
Returns Logs in Memory as List(Of String) if Debug is enabled
Returns an empty list if debug is disabled
A list of log messages
Initializes a new LogConfig object with the options supplied as a LogOptions object
Initializes a new LogConfig object with a logpath and optinally a filename-suffix.
The basepath to write logs to. Can be AppData, CurrentDirectory or CustomPath.
If `logPath` is set to custom, this defines the custom logPath.
If set to anything other than Nothing, extends the logfile name with this suffix.
CompanyName is used to construct log-path in when LogPath is set to PathType:AppData
ProductName is used to construct log-path in when LogPath is set to PathType:AppData
Amount of days where files are kept and not deleted.
Clears old LogFiles from the configured logpath for compliance with the GDPR
Days in which logfiles should be kept. All files older than `Now - FileKeepInterval` will be deleted.
True, if files were deleted as expected or no files were deleted. Otherwise false.
Returns the Logger for the calling class
An object of Logging.Logger
Returns the Logger for the specified classname
An object of Logging.Logger
Returns the Logger for the specified module using event-properties
https://github.com/NLog/NLog/wiki/EventProperties-Layout-Renderer
https://stackoverflow.com/questions/31337030/separate-log-file-for-specific-class-instance-using-nlog/32065824#32065824
An object of Logging.Logger
Returns the Logger for a class specified by `ClassName`
The name of the class the logger belongs to
An object of Logging.Logger
Clears the internal log
Gets the fully qualified name of the class invoking the calling method,
including the namespace but Not the assembly.
The fully qualified class name
This method is very resource-intensive!
Returns the initial log configuration
The chosen productname
The chosen suffix
A NLog.LoggingConfiguration object
Adds the default rules
A NLog.LoggingConfiguration object
Returns the full path of the current default log file.
Full path of the current default log file
Reconfigures and re-adds all loggers, optionally adding the debug rule.