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:
the powerJobs Processor Application with the TraceWindow: powerJobs.exe
the powerJobs Processor Addin in the JobProcessor
the powerJobs Settings Dialog
the powerShell IDE
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 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.
powerJobs.exe
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:
73 74 | <logger name="ProcessorWindow">
</logger>
|
Following LogAppender is used:
LogFile
This is the main LogAppender used in all the loggers. If you want to change the Logging Levels in the logfile, please visit following appender:
3 | <appender name="FileAppender" type="log4net.Appender.RollingFileAppender">
|
In the line
5 | <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
68 69 70 71 72 | <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.
JobProcessor Addin
By default the Autodesk JobProcessor creates logfiles located in the ‘C:\Users\{USER}\AppData\Roaming\Autodesk\Autodesk Vault Job Processor’ directory when jobs are processed.
Its verbosity can be increased by modifying the configuration file in C:\Program Files\Autodesk\Vault …\Explorer\JobProcessor.exe.config.
In order to increase the Logging Levels for your custom Jobs, however the following section can be used to control the logging behaviour for the JobHandler:
75 76 77 | <logger name="powerJobs.JobHandler">
<appender-ref ref="MsgAppender"/>
</logger>
|
powerJobs Processor provides it’s own PSHost, for which the logging can be configured in the section:
78 79 80 | <logger name="coolOrange.Powershell">
<appender-ref ref="MsgAppender"/>
</logger>
|
Following sections are used to control the logging behaviour for the powerJobs- and powerVault-Cmdlets:
81 82 83 84 85 86 | <logger name="powerJobs.Cmdlets">
<appender-ref ref="MsgAppender"/>
</logger>
<logger name="powerVault.Cmdlets">
<appender-ref ref="MsgAppender"/>
</logger>
|
In addition to the LogFiles generated by powerJobs Processor the following LogAppender is available:
Trace Window
If you want to change the logging level or format of the logs that are displayed in the Trace Window please visit the MsgSenderAppender which is only used from the JobProcessor extension:
23 | <appender name="MsgAppender" type="powerJobs.Common.MsgSenderAppender, powerJobs.Common, Version=22.0.0.0, Culture=neutral, PublicKeyToken=b8042d5e1878fff1" >
|
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.
28 29 30 31 | <filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="INFO" />
<levelMax value="FATAL" />
</filter>
|
By changing the conversion pattern you change how the message looks like.
25 26 27 | <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[ %-5level] - %message" />
</layout>
|
Settings Dialog
Following section is used to control the logging behaviour for the powerJobs Settings Dialog:
87 88 | <logger name="powerJobs.VaultExtension">
</logger>
|
Only the LogFile appender is used.
PowerShell IDE
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.
35 | <appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
|
In the lines
61 62 63 64 | <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:
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | <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>
|
Note
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