Logging

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 loglevel.

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.

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 level.

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 powerFLC Cmdlets.

    <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:

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

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

<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
<param name="File" value="${LOCALAPPDATA}\coolOrange\powerFLC\Logs\powerFLC.log" />
you can configure the outputpath and name of the logfile.

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

	<logger name="powerFLC.VaultExtension" />

Only the LogFile appender is used.

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.

<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
In the lines
<filter type="log4net.Filter.LevelRangeFilter">
	<levelMin value="INFO" />
	<levelMax value="FATAL" />
</filter>
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:

<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>

Troubleshooting

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