Logging

powerJobs Processor 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 Processor\Logs\powerJobs Processor.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\powerJobs Processor\powerJobs Processor.log4net.
Further information about log4Net Configurations can be found here.

You can change the logging behaviour of:

When to change the logging behavior?

When you have issues or when you want to get a more detailed knowledge about what powerJobs Processor or powerVault cmdlets are doing, 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.

If you need to get more details of errors that happen in the powerJobs Processor application, this is the right place to change the loglevel.

Following section is used to control the logging behaviour for the powerJobs.exe:

	<logger name="ProcessorWindow">
	</logger>


Following LogAppenders are 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:

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

In the line

<param name="File" value="${LOCALAPPDATA}\coolOrange\powerJobs Processor\Logs\powerJobs Processor.log" />
you can configure the outputpath and name of the logfile.

Since this appender has no configured LevelRangeFilter, it's loggingLevel has to be configured on the loggers.
In the lines

<root>
	<level value="INFO" />
	<appender-ref ref="FileAppender"/>
	<appender-ref ref="ColoredConsoleAppender" />
</root>
you can configure the logginglevel. You could set the level to “DEBUG”, than all the levels between the range Debug and Fatal will be logged.

This is usually the place where you want to increase the logging level of your Jobs.
Following section is used to control the logging behaviour for the JobHandler:

	<logger name="powerJobs.JobHandler">
		<appender-ref ref="MsgAppender"/>
		<appender-ref ref="JobProcessorServicesAppender" />
	</logger>
powerJobs Processor provides it's own PSHost, for which the logging can be configured in the section:
	<logger name="coolOrange.Powershell">
		<appender-ref ref="MsgAppender"/>
		<appender-ref ref="JobProcessorServicesAppender" />
	</logger>
Following sections are used to control the logging behaviour for the powerJobs- and powerVault-Cmdlets:
	<logger name="powerJobs.Cmdlets">
		<appender-ref ref="MsgAppender"/>
		<appender-ref ref="JobProcessorServicesAppender" />
	</logger>
	<logger name="powerVault.Cmdlets">
		<appender-ref ref="MsgAppender"/>
		<appender-ref ref="JobProcessorServicesAppender" />
	</logger>



In addition to the LogFile, following LogAppenders are only used from the JobProcessor extension:

Trace Window

If you want to change the logging level or format of the logs that are displayed in the powerJobs Processor TraceWindow, please visit following appender:

<appender name="MsgAppender" type="powerJobs.Common.MsgSenderAppender, powerJobs.Common" >
In the following lines you see the Range Filter which is currently used. By changing the minimum level to DEBUG it would log debugging information to the Trace Window.
<filter type="log4net.Filter.LevelRangeFilter">
	<levelMin value="INFO" />
	<levelMax value="FATAL" />
</filter>

By changing the conversion pattern you change how the message looks like.

<layout type="log4net.Layout.PatternLayout">
	<ignoresException value="false" />
	<conversionPattern value="[ %-5level] - %message" />
</layout>

Job Result

For all failed jobs in the Job Queue, all the according Warnings and Errors that where logged during job execution can be found in the Result of the according job.

The format of the error description or the log level can be configured similarly as for the logfile:

<appender name="JobProcessorServicesAppender" type="coolOrange.VaultServices.Logging.JobProcessorServicesAppender, ..., Culture=neutral, PublicKeyToken=9da561e2a3843012" >
With this appender you can change the behaviour how powerJobs Processor logs to the default JobProcessor logging mechanism.
By default the Autodesk JobProcessor creates logfiles located in the JobProcessor installation directory:
C:\Program Files\Autodesk\Vault …\Explorer\[GUID]JobProcessor.log

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

	<logger name="powerJobs.VaultExtension">
	</logger>

Only the LogFile appender is used.

When debugging or creating jobs in powerShell IDEs, the same logging as the JobProcessor log window is logged into the powerShell console window.
For that the powerJobs- and powerVault-Cmdlets loggers are getting used.

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.

When powerVault cmdlet's are getting used before importing the powerJobs Module, not all the powerVault logging can be redirected to the logger configured in the according section of the JobProcessor addin