QVTo has a org.eclipse.m2m.qvt.oml.util.WriterLog class that implements
org.eclipse.m2m.qvt.oml.util.Log. There is a:

void log(String message, Object param);

method in the interface. If I do this in QVTo:

log("some message", someObj);

I would expect that 'param' in the log method of the Log interface,
would get the value of the object I provided (someObj in this case).

However, the doVisitLogExp method of the
org.eclipse.m2m.internal.qvt.oml.evaluator.QvtOperationalEva luationVisitorImpl
class (which calls the log method of the logger), uses the
EvaluationUtil.formatLoggedElement method to convert the object to a
string representation, before passing it along to the log method of the
logger.

This means that the log method of the logger (like the WriterLog class),
always get strings instead of the objects. This also means I can't do
anything custom to create different string representations for the
objects being logged. That is, not without changing QVTo itself.

My questions:
- Why is the object converted to string before passing it to the
logger?
- Could this behavior be changed, so that the object itself is passed
to the logger?

Dennis Hendriks wrote:
> Hello all,
>
> QVTo has a org.eclipse.m2m.qvt.oml.util.WriterLog class that implements
> org.eclipse.m2m.qvt.oml.util.Log. There is a:
>
> void log(String message, Object param);
>
> method in the interface. If I do this in QVTo:
>
> log("some message", someObj);
>
> I would expect that 'param' in the log method of the Log interface,
> would get the value of the object I provided (someObj in this case).
>
> However, the doVisitLogExp method of the
> org.eclipse.m2m.internal.qvt.oml.evaluator.QvtOperationalEva luationVisitorImpl
> class (which calls the log method of the logger), uses the
> EvaluationUtil.formatLoggedElement method to convert the object to a
> string representation, before passing it along to the log method of the
> logger.
>
> This means that the log method of the logger (like the WriterLog class),
> always get strings instead of the objects. This also means I can't do
> anything custom to create different string representations for the
> objects being logged. That is, not without changing QVTo itself.
>
> My questions:
> - Why is the object converted to string before passing it to the
> logger?
> - Could this behavior be changed, so that the object itself is passed
> to the logger?
>
> Best regards,
> Dennis

Sergey Boyko wrote:
> Hi Dennis,
>
> Looks like doVisitLogExp() performs excessive toString() conversion.
> I've files this as a bug:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=327757
>
> Regards,
> Sergey
>
> Dennis Hendriks wrote:
>> Hello all,
>>
>> QVTo has a org.eclipse.m2m.qvt.oml.util.WriterLog class that
>> implements org.eclipse.m2m.qvt.oml.util.Log. There is a:
>>
>> void log(String message, Object param);
>>
>> method in the interface. If I do this in QVTo:
>>
>> log("some message", someObj);
>>
>> I would expect that 'param' in the log method of the Log interface,
>> would get the value of the object I provided (someObj in this case).
>>
>> However, the doVisitLogExp method of the
>> org.eclipse.m2m.internal.qvt.oml.evaluator.QvtOperationalEva luationVisitorImpl
>> class (which calls the log method of the logger), uses the
>> EvaluationUtil.formatLoggedElement method to convert the object to a
>> string representation, before passing it along to the log method of
>> the logger.
>>
>> This means that the log method of the logger (like the WriterLog
>> class), always get strings instead of the objects. This also means I
>> can't do anything custom to create different string representations
>> for the objects being logged. That is, not without changing QVTo itself.
>>
>> My questions:
>> - Why is the object converted to string before passing it to the
>> logger?
>> - Could this behavior be changed, so that the object itself is passed
>> to the logger?
>>
>> Best regards,
>> Dennis