Home » Archived » M2M (model-to-model transformation) » QVTo log writer gets strings instead of objects, making custom loggers useless/impossible
QVTo log writer gets strings instead of objects, making custom loggers useless/impossible [message #631110] |
Wed, 06 October 2010 08:06 |
Eclipse User |
|
|
|
Originally posted by: dhendriksREMOVE_THIS.tueREMOVE.THIS.nl
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
|
|
|
Re: QVTo log writer gets strings instead of objects, making custom loggers useless/impossible [message #632819 is a reply to message #631110] |
Thu, 14 October 2010 11:16 |
Sergey Boyko Messages: 171 Registered: July 2009 |
Senior Member |
|
|
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
|
|
|
Re: QVTo log writer gets strings instead of objects, making custom loggers useless/impossible [message #632824 is a reply to message #632819] |
Thu, 14 October 2010 11:49 |
Eclipse User |
|
|
|
Originally posted by: dhendriksREMOVE_THIS.tueREMOVE.THIS.nl
OK, thanks Sergey.
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
|
|
|
Goto Forum:
Current Time: Fri Apr 26 15:40:21 GMT 2024
Powered by FUDForum. Page generated in 0.02793 seconds
|