While using a LogService parameter for logging during the initialize method of an initializable DynamicCommand works just fine, the same cannot be done with a Logger parameter, as it throws a NullPointerException.
I assume the reason for this is the different priorities of LoggerPreprocessor vs. ServicePreprocessor:
While using a
LogService
parameter for logging during theinitialize
method of an initializableDynamicCommand
works just fine, the same cannot be done with aLogger
parameter, as it throws a NullPointerException.I assume the reason for this is the different priorities of
LoggerPreprocessor
vs.ServicePreprocessor
:https://github.com/scijava/scijava-common/blob/f1f666a8aded15e05660aece5707cd0f8b12521d/src/main/java/org/scijava/module/process/LoggerPreprocessor.java#L47-L48
https://github.com/scijava/scijava-common/blob/f1f666a8aded15e05660aece5707cd0f8b12521d/src/main/java/org/scijava/module/process/ServicePreprocessor.java#L62-L63
... and can likely be solved by increasing the priority of the former. I am unsure though if this might have any unwanted side effects elsewhere.
@ctrueden, @maarzt: if you agree, I'll test and file a pull request.