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.0.7
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
logPath, PathType
The basepath to write logs to. Can be AppData, CurrentDirectory or CustomPath.
- AppData: writes to local application data directory
- CurrentDirectory: writes to `Log` directory relative to the current directory
- CustomPath: writes to custom path specified in `customLogPath`
customLogPath, String (optional)
If `logPath` is set to custom, this defines the custom logPath.
suffix, String (optional)
If set to anything other than Nothing, extends the logfile name with this suffix.
LogFile, String (readonly)
Returns the full path of the default log file.
LogPath, String (readonly)
Returns the path to the log directory.
LogFactory, NLog.LogFactory (readonly)
Returns the LogFactory that is used to create the Logger object
Debug, Boolean
Determines if the debug log should be written.
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.
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.
Returns the Logger for the calling class
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
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.
Adds the Debug rule if true.
Prints a preformatted Block including a block identifier
A unique Identifier for this block, eg. DocId, FullPath, ..