# Logging powerLoad (bcpToolkit) tools use [Apache log4net]() as core logging library, and additionally [PostSharp Diagnostics]() for extended Debug logging. By default, all the logs are stored in a logfile located in *'C:\\Users\\\{USER}\\AppData\\Local\\coolOrange\\bcpToolkit\\Logs\\bcpToolkit.log'* and it contains Infos, Warnings and Errors.\ Perhaps you can find backups of previous logfiles in this directory. The log4net settings file is located in *C:\\Program Files\\coolOrange\\bcpToolkit\\bcpToolkit.log4net*.\ Further information about log4Net Configurations can be found [here](). You can change the logging behaviour of: - [bcpViewer](), it's engine, Window and database - the [PowerShell IDE]() - projects using the [.NET Library]() ## When to change the logging behavior? When you have issues or when you want to get a more detailed knowledge about what went wrong, you can increase the [loglevel](). :::{note} When changing the loglevel to *DEBUG* [PostSharp Diagnostics]() will be enabled and will log all the function calls into the log files. This could cause performance issues ::: Additionally you can change the logfile location or integrate the logging mechanism into your administrative environment by using build in EventLogMessages etc. Following section is used to control the logging behaviour for all tools: ```{code-block} xml :lineno-start: 63 :linenos: ... ``` For the moment only following *LogAppender* is used: ## LogFile This is the main *LogAppender* used in all the loggers. If you want to change the [logging level]() in the logfile, please visit following appender: ```{code-block} xml :lineno-start: 3 :linenos: ``` In the line ```{code-block} xml :lineno-start: 6 :linenos: ``` you can configure the outputpath and name of the logfile. Since this appender has no configured *LevelRangeFilter*, its loggingLevel has to be configured on the loggers.\ In the lines ```{code-block} xml :lineno-start: 63 :linenos: ``` you can configure the logging level. You could set the level to "DEBUG", then all the levels between the range Debug and Fatal will be logged. ## bcpViewer Following section is used to control the logging behaviour for the *bcpViewer.exe* and it's *engine* logic: ```{code-block} xml :lineno-start: 68 :linenos: ``` In order to configure sub-functionalities like the *UserInterface*, the following configuration section could be used: ```{code-block} xml :lineno-start: 70 :linenos: ``` This is the place where you want to increase the logging level when you need more detailed informations about whats happening in the bcpViewer *Database*. ```{code-block} xml :lineno-start: 72 :linenos: ``` For all this sections, only the [LogFile]() appender is used. ## PowerShell IDE When using bcpToolkit cmdlets in PowerShell environments, logs are written to the PowerShell *Console Window*.\ Following section is used to control the logging behaviour for the *Cmdlets* of this module: ```{code-block} xml :lineno-start: 80 :linenos: ... ``` In order to customize the logging level in the console window, visit following appender that is used in addition to the [LogFile](). ### ColoredConsoleAppender *ColoredConsoleAppenders* are working for PowerShell IDE's that support console windows. ```{code-block} xml :lineno-start: 23 :linenos: ``` In the lines ```{code-block} xml :lineno-start: 50 :linenos: ``` you can configure the required [logging level](). You could set the minimal filter level to "DEBUG", than all the levels between the range Debug and Fatal will be logged. We are using a ColoredConsoleAppender, therefore you could also change the colors of the messages, depending on their log level: ```{code-block} xml :lineno-start: 25 :linenos: ``` :::{admonition} Troubleshooting :class: note The **PowerShell ISE** currently does not support [console logs]() at all. ::: In addition to the earlier described logging section *'bcpToolkit.Cmdlets'*, following section can be adjusted for PowerShell environments as well, since they make use of the [.NET library]() internally. ## Projects using .NET Library When using the bcpDevKit .NET library in *custom projects*, logging can be controlled in following section: ```{code-block} xml :lineno-start: 75 :linenos: ... ``` In addition to the [LogFile](), all projects that support console windows will make use of the configuration for the [ColoredConsoleAppender]() too.\ For debugging purpose, following additional appender can be adjusted in order to meet your projects requirements: ### OutputDebugStringAppender The *OutputDebugStringAppender* writes to the OutputDebugString system. ```{code-block} xml :lineno-start: 56 :linenos: ``` When developing new projects this can be useful because the logs are directly shown in the [Visual Studio Output Window]().