Logging

powerJobs Client 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\powerJobs Client\Logs\powerJobs Client.log’ and it contains only Infos, Warnings and Errors.

The log4net settings file is located in C:\ProgramData\Autodesk\Vault {Version}\Extensions\powerJobs Client.NetFramwork\powerJobs Client.log4net.
Further information about log4Net Configurations can be found here.

You can change the logging behaviour of:

  • the WebServiceExtension for job monitoring

  • powerAPS Cmdlets

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.

LogFile

The main logging-Appender is the FileAppender :

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

If you want to change the Logging Levels for the logfile, please visit in the configuartion 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\powerJobs Client\Logs\powerJobs Client.log" />

you can configure the outputpath and name of the logfile.

If you need to get more details of errors that happen in the WebServiceExtension that handles the job monitoring, this section is the right place to change the loglevel.

To control the logging behaviour of powerAPS Cmdlets, use the following dedicated section:

<logger name="powerAPS.Cmdlets">
	<appender-ref ref="ColoredConsoleAppender" />
</logger>

PowerShell IDE

When debugging client customizations witin PowerShell IDEs (e.g., PowerShell Console or PowerShell ISE), powerAPS Cmdlets also write logs directly to the Console Window.

To control the minimum and maximum logging levels shown in the console, adjust the following lines for the ColoredConsoleAppender :

<appender name="ColoredConsoleAppender" type="log4net.Appender.ManagedColoredConsoleAppender">
 	...
	<filter type="log4net.Filter.LevelRangeFilter">
		<levelMin value="INFO" />
		<levelMax value="FATAL" />
	</filter>
</appender>

You could set the minimal filter level to “DEBUG”, than all the levels between the range Debug and Fatal will be logged.

Each log level can be styled with different foreground and background colors for better visibility:

<mapping>
        <level value="DEBUG" />
        <foreColor value="Black" />
        <backColor value="White" />
</mapping>
<mapping>
        <level value="INFO" />
        <backColor value="DarkGreen" />
</mapping>
<mapping>
        <level value="WARN" />
        <foreColor value="Black" />	
        <backColor value="Yellow" />
</mapping>
<mapping>
        <level value="ERROR" />
        <backColor value="Red" />
</mapping>
<mapping>
        <level value="FATAL" />
        <backColor value="DarkRed" />
</mapping>

<layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>

These and many other options give you full control over what gets logged and how the messages appear in the console.