Logging

powerPLM (powerFLC) uses 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\powerFLC\Logs\powerFLC.log’ and it contains only Infos, Warnings and Errors.

The log4net settings file is located in C:\Program Files\coolOrange\Modules\powerFLC\powerFLC.log4net.
Further information about log4Net Configurations can be found here.

You can change the logging behavior of:

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 Logging Levels.

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.

Workflows

When you need to get more details of errors that happen for Sample or Custom Workflows, this are the right places to increasing the Logging Levels.

Since workflows consists of powerJobs Processor Jobs, they are writing directly to the powerJobs Processor - Trace Window and its LogFile located in ‘C:\Users\{USER}\AppData\Local\coolOrange\powerJobs Processor\Logs\powerJobs Processor.log’ by default.
Therefore the powerJobs - JobProcessor Addin sections are the right places where you want to configure the logging behavior for workflow jobs like Sample.TransferItemBOMs.

The following sections are used to control the logging behavior for the Cmdlets.

63
64
65
66
67
68
<logger name="powerFLC.Cmdlets">
	...
</logger>
<logger name="coolOrange.Powershell">
	...
</logger>

Both of them make use of the following main LogAppender by default:

LogFile

The FileAppender is the main appender and most loggers us it:

4
<appender name="FileAppender" type="log4net.Appender.RollingFileAppender">

If you want to change the Logging Levels for the logfile, please visit in the configuration file in the lines:

57
58
59
60
61
<root>
	<level value="INFO" />
	<appender-ref ref="FileAppender"/>

</root>

In that root element, you can configure the logginglevel for all appenders. You could set the level to “DEBUG”, than all the appenders will log in debug.
In the line

6
<param name="File" value="${LOCALAPPDATA}\coolOrange\powerFLC\Logs\powerFLC.log" />

you can configure the outputpath and name of the logfile.

Vault Menu Addin

Following section is used to control the logging behaviour for the Vault Menu extension:

62
<logger name="powerFLC.VaultExtension" />

Only the LogFile appender is used.

PowerShell IDE

When using the powerFLC cmdlets in PowerShell environments, or when debugging or creating workflows in PowerShell IDEs, all the logs that would be shown in the powerJobs Processor - Trace Window are written into the PowerShell console window.

In order to customize the logging level in the console window, visit following appender:

ColoredConsoleAppender

ColoredConsoleAppenders are working for PowerShell IDE’s that support console windows.

24
<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">

In the lines

51
52
53
54
<filter type="log4net.Filter.LevelRangeFilter">
	<levelMin value="INFO" />
	<levelMax value="FATAL" />
</filter>

you can configure the required Logging Levels. 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:

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<mapping>
	<level value="DEBUG" />
	<backColor value="White" />
</mapping> <mapping>
	<level value="INFO" />
	<backColor value="Green" />
</mapping> <mapping>
	<level value="WARN" />
	<backColor value="Yellow" />
</mapping> <mapping>
	<level value="ERROR" />
	<backColor value="Red" />
</mapping> <mapping>
	<level value="FATAL" />
	<backColor value="Red, HighIntensity" />
</mapping> </sxh>

Troubleshooting

However the PowerShell ISE currently does not support console logs at all.