Logging Options

derickbailey edited this page Aug 12, 2010 · 5 revisions

There are a few settings that you can use for logging, from every Albacore rake task. These settings apply to the specific task instance only, at this point. So if you want to configure logging on multiple instances of a msbuildtask, you have to configure it on each task.

log_level

Each task supports a .log_level setting. The only valid option for this setting is “:verbose”. Any other option specified will put the log_level back to non-verbose mode.

obj.log_level = :verbose

The default for log_level is to be in non-verbose mode.

When a task has it’s log_level set to verbose mode, you will receive “debug” level logging information in the log output. This may include data such as the individual attributes that are being generated by the assemblyinfotask, or other such data that may not be useful during the normal operations of the task.

Verbose mode is probably most useful during the setup and debugging of your rake scripts.

log_device

Each task supports a .log_device setting. This allows you to change the output location of the logging messages. The default logging location is “STDOUT”. This will dump all log messages to the console window, where most CI servers will pick it up.

You can change this setting to any valid IO device, such as a StringIO object.

strio = StringIO.new
obj.log_device = strio

You will not likely have much use for this, unless your CI build environment wants to have logging information dumped into a very specific place, such as a file. Honestly, the primary reason I included this option was for the functional specification tests that I wrote around the tasks. I needed a way to capture the logged information, to verify it was correct.